admin管理员组文章数量:1026989
I am trying to figure out the setup for unit tests for wordpress plugins. I am using Ubuntu. So far I have:
- Local WordPress Installation
- WP-CLI up and running
- Installed phpunit
- used wp scaffold command to generate unit test files
When I now try and run the phpunit command I get the following error:
PHP Warning: require_once(/tmp/wordpress//wp-includes/class- phpmailer.php): failed to open stream: No such file or directory in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
PHP Fatal error: require_once(): Failed opening required '/tmp/wordpress//wp-includes/class-phpmailer.php' (include_path='.:/usr/share/php:/usr/share/pear') in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
This is my wp --info:
PHP binary: /usr/bin/php5
PHP version: 5.6.11-1ubuntu3.4
php.ini used: /etc/php5/cli/php.ini
WP-CLI root dir: phar://wp-cli.phar
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 1.0.0
I am trying to follow this tutorial:
/
Thank you for any help!!!
I am trying to figure out the setup for unit tests for wordpress plugins. I am using Ubuntu. So far I have:
- Local WordPress Installation
- WP-CLI up and running
- Installed phpunit
- used wp scaffold command to generate unit test files
When I now try and run the phpunit command I get the following error:
PHP Warning: require_once(/tmp/wordpress//wp-includes/class- phpmailer.php): failed to open stream: No such file or directory in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
PHP Fatal error: require_once(): Failed opening required '/tmp/wordpress//wp-includes/class-phpmailer.php' (include_path='.:/usr/share/php:/usr/share/pear') in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
This is my wp --info:
PHP binary: /usr/bin/php5
PHP version: 5.6.11-1ubuntu3.4
php.ini used: /etc/php5/cli/php.ini
WP-CLI root dir: phar://wp-cli.phar
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 1.0.0
I am trying to follow this tutorial:
https://pippinsplugins/unit-tests-wordpress-plugins-setting-up-testing-suite/
Thank you for any help!!!
Share Improve this question asked Dec 15, 2016 at 20:16 Mauro BringolfMauro Bringolf 1772 silver badges7 bronze badges 3 |1 Answer
Reset to default 1If you're on Windows, open wp-tests-config.php and change the ABSPATH with absolute path to your TEMP folder. For example:
define( 'ABSPATH', 'C:\Users\{User}\AppData\Local\Temp/wordpress/' );
I changed this and phpunit worked! This code is on line 7 in %TEMP%/wordpress-tests-lib/wp-tests-config.php
I am trying to figure out the setup for unit tests for wordpress plugins. I am using Ubuntu. So far I have:
- Local WordPress Installation
- WP-CLI up and running
- Installed phpunit
- used wp scaffold command to generate unit test files
When I now try and run the phpunit command I get the following error:
PHP Warning: require_once(/tmp/wordpress//wp-includes/class- phpmailer.php): failed to open stream: No such file or directory in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
PHP Fatal error: require_once(): Failed opening required '/tmp/wordpress//wp-includes/class-phpmailer.php' (include_path='.:/usr/share/php:/usr/share/pear') in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
This is my wp --info:
PHP binary: /usr/bin/php5
PHP version: 5.6.11-1ubuntu3.4
php.ini used: /etc/php5/cli/php.ini
WP-CLI root dir: phar://wp-cli.phar
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 1.0.0
I am trying to follow this tutorial:
/
Thank you for any help!!!
I am trying to figure out the setup for unit tests for wordpress plugins. I am using Ubuntu. So far I have:
- Local WordPress Installation
- WP-CLI up and running
- Installed phpunit
- used wp scaffold command to generate unit test files
When I now try and run the phpunit command I get the following error:
PHP Warning: require_once(/tmp/wordpress//wp-includes/class- phpmailer.php): failed to open stream: No such file or directory in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
PHP Fatal error: require_once(): Failed opening required '/tmp/wordpress//wp-includes/class-phpmailer.php' (include_path='.:/usr/share/php:/usr/share/pear') in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
This is my wp --info:
PHP binary: /usr/bin/php5
PHP version: 5.6.11-1ubuntu3.4
php.ini used: /etc/php5/cli/php.ini
WP-CLI root dir: phar://wp-cli.phar
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 1.0.0
I am trying to follow this tutorial:
https://pippinsplugins/unit-tests-wordpress-plugins-setting-up-testing-suite/
Thank you for any help!!!
Share Improve this question asked Dec 15, 2016 at 20:16 Mauro BringolfMauro Bringolf 1772 silver badges7 bronze badges 3- 1 I have the same problem on Windows. Can't find much info on this anywhere. – Robin Andrews Commented Mar 27, 2017 at 22:18
- I recently switched to MacOS for all WordPress development. Have not figured it out on Windows yet either. – Mauro Bringolf Commented Apr 15, 2017 at 16:03
-
I've found that the tutorial cited lacks some key instructions, only one of which I've figured out. It does not say to install svn (subversion) before starting. Once I did that I had to run the lines that call
svn co...
by hand. What is not at all made clear and remains unknown is how the tutorial's database knows their plugin is installed. When I checked my test database it had none of the settings of an activated plugin. Tutorial may be necessary but is insufficient for testing. – geoB Commented Jun 7, 2017 at 21:36
1 Answer
Reset to default 1If you're on Windows, open wp-tests-config.php and change the ABSPATH with absolute path to your TEMP folder. For example:
define( 'ABSPATH', 'C:\Users\{User}\AppData\Local\Temp/wordpress/' );
I changed this and phpunit worked! This code is on line 7 in %TEMP%/wordpress-tests-lib/wp-tests-config.php
本文标签: pluginsError when setting up phpunit tests with wpcli scaffold
版权声明:本文标题:plugins - Error when setting up phpunit tests with wp-cli scaffold 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745611150a2159011.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
svn co...
by hand. What is not at all made clear and remains unknown is how the tutorial's database knows their plugin is installed. When I checked my test database it had none of the settings of an activated plugin. Tutorial may be necessary but is insufficient for testing. – geoB Commented Jun 7, 2017 at 21:36