afragen / setup-phpunit

Setup PHPUnit for use in Local Lightning
MIT License
20 stars 6 forks source link

Could not find `functions.php` #6

Closed crstauf closed 2 years ago

crstauf commented 2 years ago

After running bash setup-phpunit.sh and navigating to plugin with unit tests:

$ phpunit
Could not find /var/folders/hk/4slx_nm557x9mlqwlqjkkxsw0000gn/T/wordpress-tests-lib/includes/functions.php, have you run bin/install-wp-tests.sh ?

Does install-wp-tests.sh need to be run?

afragen commented 2 years ago

Your individual plugin needs to be scaffolded to run unit tests.

crstauf commented 2 years ago

It has already: bin/install-wp-tests.sh exists, but I was under the impression that this script does everything and is a replacement for install-wp-tests.sh, thus my question: does it need to be run?

afragen commented 2 years ago

You shouldn't need to run it. It should all be in the script.

crstauf commented 2 years ago

Understood. Does a write permissions issue seem likely in that case?

afragen commented 2 years ago

It's possible. That's usually supposed to be the /tmp directory.

afragen commented 2 years ago

I think you do need to run install-wp-tests.php. I think it's usually run from the bootstrap file.

crstauf commented 2 years ago

@afragen Where can I find install-wp-tests.php, and what's the bootstrap file?

afragen commented 2 years ago

https://developer.wordpress.org/cli/commands/scaffold/plugin/

crstauf commented 2 years ago

I'm not certain what changed, but it's working now. ¯\(ツ)

Thanks for your help, @afragen! :cookie: