/** * Checks if scenario or outline matches specified filter. * * @param ScenarioInterface $scenario Scenario or Outline node instance * * @return Boolean */ public function isScenarioMatch(ScenarioInterface $scenario) { if ('/' === $this->filterString[0] && 1 === preg_match($this->filterString, $scenario->getTitle())) { return true; } elseif (false !== mb_strpos($scenario->getTitle(), $this->filterString, 0, 'utf8')) { return true; } return false; }
public function __construct(FeatureNode $featureNode, ScenarioInterface $scenarioNode, $steps = []) { $this->featureNode = $featureNode; $this->scenarioNode = $scenarioNode; $this->steps = $steps; $this->setMetadata(new Metadata()); $this->scenario = new Scenario($this); $this->getMetadata()->setName($featureNode->getTitle()); $this->getMetadata()->setFeature($scenarioNode->getTitle()); $this->getMetadata()->setFilename($featureNode->getFile()); }
public function createFilename(FeatureNode $feature, ScenarioInterface $scenario, OutlineNode $outline = null) { $filename = Transliterator::transliterate($feature->getTitle(), $this->separator) . DIRECTORY_SEPARATOR; if ($outline) { $filename .= Transliterator::transliterate($outline->getTitle(), $this->separator) . DIRECTORY_SEPARATOR . $this->separator; } $filename .= Transliterator::transliterate($scenario->getTitle(), $this->separator); if ($outline) { $filename .= $this->separator; } return $filename; }
/** * @param ScenarioInterface $scenario * @return array */ private function getTitleLines(ScenarioInterface $scenario) { return array_map('trim', explode("\n", $scenario->getTitle())); }
private function getScenarioDescription(ScenarioInterface $scenario) { return ($scenario->hasTags() ? $this->indent() : '') . sprintf('%s: %s%s', trim($scenario->getKeyword()), trim($scenario->getTitle()), PHP_EOL); }
/** * add testResults info about scenario * * @param FeatureNode $feature feature object * @param ScenarioInterface $scenario scenario object * * @return null */ public function addScenario(FeatureNode $feature, ScenarioInterface $scenario) { $featurePath = $feature->getFile(); $scenarioLine = $scenario->getLine(); $this->testResults[$featurePath]["scenarios"][$scenarioLine] = ["steps" => [], "name" => $scenario->getTitle(), "testResultCode" => TestResult::PASSED, "testResult" => self::RESULT_CODES_MAPPING[TestResult::PASSED]]; }