I'm following the Plugin Unit Tests guide.
When running phpunit I get the following error:
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
Fatal error: require_once(): Failed opening required '/tmp/wordpress//wp-includes/class-phpmailer.php' (include_path='.:/opt/lampp/lib/php') in /tmp/wordpress-tests-lib/includes/mock-mailer.php on line 2
My /tmp/wordpress directory is empty.
Can you share wp --info ? And can you try deleting /tmp/wordpress and running bash bin/install-wp-tests.sh again?
It looks like the deleting the empty /tmp/wordpress folder fixed it. Thanks for the help!
If 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}AppDataLocalTemp/wordpress/' );
I changed this and phpunit worked! This code is on line 7 in %TEMP%/wordpress-tests-lib/wp-tests-config.php
Most helpful comment
If 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}AppDataLocalTemp/wordpress/' );
I changed this and phpunit worked! This code is on line 7 in %TEMP%/wordpress-tests-lib/wp-tests-config.php