paulgibbs / behat-wordpress-extension

WordHat: Behat for WordPress
https://wordhat.info
GNU General Public License v3.0
106 stars 20 forks source link

Adding wp cli acceptance #229

Closed killua99 closed 5 years ago

killua99 commented 5 years ago

Would be nice to have the same acceptance test from the scaffold-package to test in our wp project customs cli commands.

https://github.com/wp-cli/scaffold-package-command/blob/2204f3ca1f962672f99910ae73c3abbc25fb9a70/features/steps/then.php

paulgibbs commented 5 years ago

Thanks for writing. I’m not sure what you mean, sorry. What are you trying to do please?

killua99 commented 5 years ago

Yes, sorry I didn't explain very well what I was doing.

I'm looking to add some behat tests for my custom plugin inside a WordPress project, I was trying to add the same context for the wp cli command but I realised I wasn't doing it right.

How could I add those context into my project.

Also would be something that could be inside this project? Now I've time to dedicate to write the code need for any pr

paulgibbs commented 5 years ago

Do you want to add WP-CLI provided Behat commands to a Behat/WordHat project?

killua99 commented 5 years ago

Indeed

paulgibbs commented 5 years ago

Good question, I don't know if it's possible. It's not something I will spend time figuring out. Looking at the WP-CLI source, https://github.com/wp-cli/wp-cli-tests/blob/master/features/bootstrap/FeatureContext.php is the context file I think you need to load. I don't know if any other files are required.

I'd suggest start by adding WP-CLI to your composer.json so that above file is added to the autoloader, and then adding that context to the top section of your behat.yml.

paulgibbs commented 5 years ago

https://stackoverflow.com/questions/42530127/how-do-i-configure-behat-to-autoload-classes-from-my-app-specific-folder suggests how you might add the WP-CLI file(s) to the autoloader