10up / wp-hammer

ARCHIVED: Please see https://github.com/10up/wp-scrubber as replacement.
MIT License
150 stars 15 forks source link

Run unit tests from wp-hammer folder #10

Open iandunn opened 6 years ago

iandunn commented 6 years ago

I may just be doing something wrong, but it seems like I have to run the unit tests from the ~/.wp-cli/packages folder, since _manually_load_plugin() assumes that's the current folder. If I run it from the wp-hammer folder, it fails:

> phpunit
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml

Warning: require_once(/Users/iandunn/.wp-cli/packages/vendor/ivankruchkoff/wp-hammer/vendor/autoload.php): failed to open stream: No such file or directory in /Users/iandunn/.wp-cli/packages/vendor/ivankruchkoff/wp-hammer/tests/bootstrap.php on line 11

Running it from the packages folder works, but requires manually passing the config file (phpunit -c vendor/ivankruchkoff/wp-hammer/phpunit.xml), instead of being able to just run phpunit.

It seems like the latter would be more convenient; is there a reason it's setup to use the former instead?

iandunn commented 6 years ago

Oh, is this because of the difference in installing via wp package vs git clone ... composer install?

If that's the case, then it'd probably be pretty easy to modify _manually_load_plugin() to support both approaches.