问题
I am starting behat with
./bin/behat --suite=SuiteName --profile=profile_name
Is it possible to get current behat profile name inside FeatureContext especially inside BeforeSuiteScope
/**
* @BeforeSuite
*/
public static function beforeSuite(BeforeSuiteScope $scope)
{
}
回答1:
So I found brute force method, I know probably its not the best way of getting profile name, but it works.
$input = new ArgvInput($_SERVER['argv']);
$profile = $input->getParameterOption(array('--profile', '-p')) ? : 'default';
var_dump($profile);die;
And ArgvInput
is Symfony\Component\Console\Input\ArgvInput
Thats how cli params parsing done in behat.
来源:https://stackoverflow.com/questions/32520667/behat-3-how-to-get-profile-name-inside-featurecontext