我从
开始./bin/behat --suite=SuiteName --profile=profile_name
是否有可能在FeatureContext中获得当前的行为配置文件名称,特别是在BeforeSuiteScope
/**
* @BeforeSuite
*/
public static function beforeSuite(BeforeSuiteScope $scope)
{
}
所以我找到了蛮力方法,我知道这可能不是获得配置文件名称的最佳方式,但它有效。
$input = new ArgvInput($_SERVER['argv']);
$profile = $input->getParameterOption(array('--profile', '-p')) ? : 'default';
var_dump($profile);die;
ArgvInput
为Symfony'Component'Console'Input'ArgvInput