コード例 #1
0
 public function testLine()
 {
     $feature = new FeatureNode();
     $this->assertEquals(0, $feature->getLine());
     $feature = new FeatureNode(null, null, null, 23);
     $this->assertEquals(23, $feature->getLine());
 }
コード例 #2
0
 /**
  * Checks if Feature matches specified filter.
  *
  * @param FeatureNode $feature Feature instance
  *
  * @return Boolean
  */
 public function isFeatureMatch(FeatureNode $feature)
 {
     return $this->filterLine === $feature->getLine();
 }
コード例 #3
0
ファイル: LineRangeFilter.php プロジェクト: higrow/Gherkin
 /**
  * Filters feature according to the filter.
  *
  * @param FeatureNode $feature
  *
  * @return FeatureNode
  */
 public function filterFeature(FeatureNode $feature)
 {
     $scenarios = array();
     foreach ($feature->getScenarios() as $scenario) {
         if (!$this->isScenarioMatch($scenario)) {
             continue;
         }
         if ($scenario instanceof OutlineNode && $scenario->hasExamples()) {
             $table = $scenario->getExampleTable()->getTable();
             $lines = array_keys($table);
             $filteredTable = array($lines[0] => $table[$lines[0]]);
             unset($table[$lines[0]]);
             foreach ($table as $line => $row) {
                 if ($this->filterMinLine <= $line && $this->filterMaxLine >= $line) {
                     $filteredTable[$line] = $row;
                 }
             }
             $scenario = new OutlineNode($scenario->getTitle(), $scenario->getTags(), $scenario->getSteps(), new ExampleTableNode($filteredTable, $scenario->getExampleTable()->getKeyword()), $scenario->getKeyword(), $scenario->getLine());
         }
         $scenarios[] = $scenario;
     }
     return new FeatureNode($feature->getTitle(), $feature->getDescription(), $feature->getTags(), $feature->getBackground(), $scenarios, $feature->getKeyword(), $feature->getLanguage(), $feature->getFile(), $feature->getLine());
 }
コード例 #4
0
 /**
  * Checks if Feature matches specified filter.
  *
  * @param FeatureNode $feature Feature instance
  *
  * @return Boolean
  */
 public function isFeatureMatch(FeatureNode $feature)
 {
     return $this->filterMinLine <= $feature->getLine() && $this->filterMaxLine >= $feature->getLine();
 }