Behat 3:如何在FeatureContext中获取配置文件名称 [英] Behat 3: How to get profile name inside FeatureContext

查看:146
本文介绍了Behat 3:如何在FeatureContext中获取配置文件名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从

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

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

Is it possible to get current behat profile name inside FeatureContext especially inside BeforeSuiteScope

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

推荐答案

所以我找到了蛮力方法,我知道它可能不是获取配置文件名称的最佳方法,但它可行.

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;

ArgvInputSymfony\Component\Console\Input\ArgvInput

那是cli参数在behat中的解析方式.

Thats how cli params parsing done in behat.

这篇关于Behat 3:如何在FeatureContext中获取配置文件名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆