Sanpi\Behatch\Context\DebugContext::getScenario PHP Метод

getScenario() приватный Метод

private getScenario ( Behat\Behat\Hook\Scope\AfterStepScope $scope ) : Behat\Gherkin\Node\ScenarioInterface
$scope Behat\Behat\Hook\Scope\AfterStepScope
Результат Behat\Gherkin\Node\ScenarioInterface
    private function getScenario(AfterStepScope $scope)
    {
        $scenarios = $scope->getFeature()->getScenarios();
        foreach ($scenarios as $scenario) {
            $stepLinesInScenario = array_map(function (StepNode $step) {
                return $step->getLine();
            }, $scenario->getSteps());
            if (in_array($scope->getStep()->getLine(), $stepLinesInScenario)) {
                return $scenario;
            }
        }
        throw new \LogicException('Unable to find the scenario');
    }