JDGrimes / wpppb

Bootstrap for integration testing WordPress plugins with PHPUnit
MIT License
13 stars 3 forks source link

No phpunit as a dependency? #26

Open dingo-d opened 5 years ago

dingo-d commented 5 years ago

I am a bit puzzled at the setup of this suite.

First what exactly is the prefix that your plugin uses in the database?

The installation recognized I have tests directory (since I'm on VVV), but then it symlinked the plugin to the tests directory and I got

ln: /Users/infinum-denis/vagrant-local/www/wordpress-develop/src/wp-content/plugins/my-plugin: No such file or directory

Because my plugin is located in a directory where I am building it (not the test one).

Also, how come phpunit isn't set as a dependency? Because I can see it's not installed in the vendor folder, and I am getting

zsh: command not found: phpunit

Thanks!

EDIT:

Once I installed phpunt (6.5) and ran vendor/bin/phpunit I get error on the require_once in the bootstrap.php because the path of the plugin is wrong (test assumes it's in the test folder, and it's not).

Is the workaround for this to just put it in the test folder or?

JDGrimes commented 5 years ago

Hi @dingo-d , sorry for the delayed reply.

First what exactly is the prefix that your plugin uses in the database?

I can see now that this isn't clear. It is just asking if your plugin uses a particular prefix for the table names/option names/meta keys/etc. that it stores in the DB. This will be used when generating the un/install test, to check that there isn't anything left in the DB with that prefix after the plugin is uninstalled.

The installation recognized I have tests directory (since I'm on VVV), but then it symlinked the plugin to the tests directory and I got

ln: /Users/infinum-denis/vagrant-local/www/wordpress-develop/src/wp-content/plugins/my-plugin: No such file or directory

Because my plugin is located in a directory where I am building it (not the test one).

You should be able to develop the plugin in any directory, that's why it is attempting to just symlink it for you. Yes, you can just copy/move/symlink it manually as a workaround. But I think that the problem is just that VVV changed the path in recent versions. WPPPB needs to add publich_html in there for the latest VVV.

Also, how come phpunit isn't set as a dependency?

I've just always installed PHPUnit globally, and so I didn't add it as a dependency, just assuming others would have PHPUnit installed globally as well. That's probably not best practice though?

dingo-d commented 5 years ago

Thanks for the answer, makes things a bit clearer 🙂

I try to limit globally installed packages, just to avoid any possible conflicts (phpcs and editors have a tendency to do that 😄).

I'll try to play with your test suite a bit more, I was trying out different tools for testing a plugin in WordPress environment so this was one of the options 🙂