【问题标题】:Behat 3: How to get profile name inside FeatureContextBehat 3:如何在 FeatureContext 中获取配置文件名称
【发布时间】:2023-04-07 09:48:02
【问题描述】:

我开始与

./bin/behat --suite=SuiteName --profile=profile_name

是否可以在 FeatureContext 中获取当前行为配置文件名称,尤其是在 BeforeSuiteScope

/**
 * @BeforeSuite
 */
public static function beforeSuite(BeforeSuiteScope $scope)
{
}

【问题讨论】:

    标签: php behat mink autotest


    【解决方案1】:

    所以我找到了蛮力方法,我知道它可能不是获取个人资料名称的最佳方法,但它确实有效。

    $input   = new ArgvInput($_SERVER['argv']);
    $profile = $input->getParameterOption(array('--profile', '-p')) ? : 'default';
    var_dump($profile);die;
    

    ArgvInputSymfony\Component\Console\Input\ArgvInput

    这就是在 behat 中完成 cli 参数解析的方式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-24
      • 1970-01-01
      • 1970-01-01
      • 2015-02-28
      • 1970-01-01
      相关资源
      最近更新 更多