Closed Simek11 closed 7 years ago
Looks like activate_plugin()
is being loaded. It's not clear why that's the case, but you may want to check that this line is being reached.
You are missing a Given I have a vanilla WordPress installation
step too. That shouldn't cause an undefined function call, but maybe the context is never instantiated if not steps are required of it?
Thank you for your response. I've checked if this line is being reached and the answer is yes. The missing given step you've mentioned is the case. If I start my scenario with Given I have a vanilla wordpress installation
, I don't get any errors, but if this given step is missing, activate_plugin()
function is not being found. I'm not very fond of using it in this way. I thought that if I don't want to install WordPress in every scenario, I can put some empty step into this WordPressContext
and call it in every scenario as given step in order to make this class loaded. Unfortunately, it doesn't work. It seems that the installWordPress()
method must be called. I don't understand why this class is so important since it has only one method.
WordPressBehatExtension resets the database after ever scenario to avoid bleeding between scenarios. I imagine your step is failing because you're actually getting the install screen.
Can I recommend you look at WordHat, which I'm collaborating on. It is similar to WordPressBehatExtension but with a crucial difference, it does not reset the database, and it does not install WordPress - that is, you're expected to insure your WordPress install is set up for testing yourself, and that you reset the database (if that is required). It sounds like that might more readily meet your needs.
It seems to be a helpful library. I can't use it, though. My PHP 5.3 environment doesn't meet WordHat's requirements. But I will know what library I should check in the future. Thank you for the recommendation.
I would like to use WordPress functions in my own FeatureContext class and write steps which are not presented in WordPressBehatExtension. Behat returns some issue when I try example from documentation. If my behat.yml file looks like this:
and my .feature file looks like this:
I get error when try to run Behat:
PHP Fatal error: Call to undefined function StephenHarris\WordPressBehatExtension\Context\Plugins\activate_plugin() in /home/vagrant/my-plugin/vendor/stephenharris/wordpress-behat-extension/src/Context/Plugins/WordPressPluginContext.php on line 21
What did I do wrong? I use vccw vagrant and run tests after I ssh into it.