问题
I have a website written in PHP with around 40 countries. I started to develop test in Behat v3, with many features. Sometimes, I need to run a feature/suite with a specific country and on a specific server.
For instance, what I have to do is :
php bin/behat --suite=mySuite --env=stg --country=US,IT,CA
Or something like that. For just retrieve URL by the environment and country passed in parameter. I think it's not possible whit Behat and if not, what kind of tool can I use ?
Thanks !
回答1:
Everything that goes beyond bin/behat
is Behat specific. So, yes, it's not possible via Behat parameters. This is easily achieved with environment parameters, which you can pass before running the script:
ENV="stg" COUNTRY="US,IT,CA" php bin/behat --suite=mySuite
In your code you retrieve them from the $_SERVER
superglobal:
$env = $_SERVER['ENV'];
$country = $_SERVER['COUNTRY'];
来源:https://stackoverflow.com/questions/26295494/parameters-in-behat-3