Behat 3: How to get profile name inside FeatureContext

a 夏天 提交于 2019-12-11 03:43:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!