Closed andergmartins closed 5 years ago
I've not tested this (will try it this evening) but you might be able to pass a command line option to wpcli through the configuration item in behat.yml by setting wpcli.binary
to (for example) wp --allow-root
. As I say, I've not tested that.
you might be able to pass a command line option to wpcli through the configuration item in behat.yml by setting wpcli.binary
Yes, that is possible (see the table on https://wordhat.info/configuration/settings.html) but I don't know if --allow-root
is going to work for sure. I can't recall with certainty if we pass any other arguments via WordHat that needs to be in the first position on the command line or not.
@andergmartins Thank you for the very detailed write-up. I'm hopeful that @rvodden's suggestion above might do it for you - try it and let us know?
We'll consider whether we can or should auto-set this parameter for the WP-CLI driver or not.
Given there is a workaround suggested above that should work, I'm going to close this ticket, as there are other priorities in WordHat's development that I feel are a better use of my own time. Personally, I'm not sure of the benefit to automatically handle running Behat/WP-CLI as root, but I would accept a well-written PR that implements that.
If anyone's game, please re-open this ticket and we can discuss. Thanks all!
Expected behaviour
I expect to run the command:
vendor/bin/behat --init
and behat is initialized without any error message.
Current behaviour
When I run the above command, it returns:
Possible solution
Wp-cli has an option for running as root:
--allow-root
. Maybe we could detect if we are inside a container or give an option to run:wp
as an alias ofwp --allow-root
?Steps to reproduce
cd wordpress_dev
docker-compose up -d
docker run -it wordpress_dev_www_1 bash
mkdir wp-content/plugins/myplugin
cd wp-content/plugins/myplugin
composer require --dev paulgibbs/behat-wordpress-extension behat/mink-goutte-driver behat/mink-selenium2-driver
vendor/bin/behat --init
After running these steps you should be able to see the error message.
Context
I'm trying to use behat-wordpress-extension for the first time while I developping a WordPress plugin.
Your environment