コード例 #1
0
ファイル: NameFilter.php プロジェクト: higrow/Gherkin
 /**
  * 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;
 }
コード例 #2
0
ファイル: Gherkin.php プロジェクト: solutionDrive/Codeception
 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());
 }
コード例 #3
0
 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;
 }
コード例 #4
0
ファイル: Scenario.php プロジェクト: malukenho/kawaii-gherkin
 /**
  * @param ScenarioInterface $scenario
  * @return array
  */
 private function getTitleLines(ScenarioInterface $scenario)
 {
     return array_map('trim', explode("\n", $scenario->getTitle()));
 }
コード例 #5
0
 private function getScenarioDescription(ScenarioInterface $scenario)
 {
     return ($scenario->hasTags() ? $this->indent() : '') . sprintf('%s: %s%s', trim($scenario->getKeyword()), trim($scenario->getTitle()), PHP_EOL);
 }
コード例 #6
0
 /**
  * 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]];
 }