Php 如何在Behat FeatureContext中获取标记

Php 如何在Behat FeatureContext中获取标记,php,testing,behat,Php,Testing,Behat,有没有办法在Behat FeatureContext中为运行该方法的场景获取标记 我的特征 特性上下文 您应该在ScenarioScope挂钩之前使用。 试着这样做: /** * @BeforeScenario */ public function getTestId(BeforeScenarioScope $scope) { $tags = $scope->getScenario()->getTags(); } 不要忘记添加u

有没有办法在Behat FeatureContext中为运行该方法的场景获取标记

我的特征 特性上下文
您应该在ScenarioScope挂钩之前使用
。
试着这样做:

    /**
     * @BeforeScenario
     */
    public function getTestId(BeforeScenarioScope $scope)
    {
        $tags = $scope->getScenario()->getTags();
    }

不要忘记添加
use Behat\Behat\Hook\Scope\BeforeScenarioScope

您应该使用
镜头前挂钩。
试着这样做:

    /**
     * @BeforeScenario
     */
    public function getTestId(BeforeScenarioScope $scope)
    {
        $tags = $scope->getScenario()->getTags();
    }
不要忘记添加
use Behat\Behat\Hook\Scope\BeforeScenarioScope

    /**
     * @BeforeScenario
     */
    public function getTestId(BeforeScenarioScope $scope)
    {
        $tags = $scope->getScenario()->getTags();
    }