cannot run phpunit with wp-cli: could not find /wordpress-tests-lib/includes/functions.php, have you run bin/

I'm trying hard to run PHP-Unit for a WordPress plugin idea using XAMPP for MacOS, but i'm just struggling so hard and just ran out of ideas about what to try, and I can't get rid of this error:

❯ phpunit
Could not find /var/folders/_f/4v8byddd4snc_0l9nsql33fc0000gn/t/wordpress-tests-lib/includes/functions.php, have you run bin/ ?

I have navigated manually to that folder, which is installed --or not-- by this command through this bash file

bin/ wordpress_mytest root root latest

The thing is, bootstrap.php requires a WP_TESTS_DIR through

$_tests_dir = getenv( 'WP_TESTS_DIR' );
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';

And then it checks if functions.php exists here:

if ( ! file_exists( "{$_tests_dir}/includes/functions.php" ) ) {
echo "Could not find {$_tests_dir}/includes/functions.php, have you run bin/ ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
exit( 1 );


manually navigating to the path printing $_tests_dir, I found only these files:

❯ pwd

❯ ls

wp-tests-config.php     wp-tests-config.php.bak

What can I be missing here?

Any help or suggestion would be greatly appreciated.

Thank you!

Read more here:

Content Attribution

This content was originally published by Eduardo Chaparro Alire at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: