setFilters() публичный Метод

Sets filters to the parser.
public setFilters ( array $filters )
$filters array
Пример #1
0
 /**
  * Executes controller.
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return null|integer
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $filters = array();
     foreach ($input->getOption('name') as $name) {
         $filters[] = new NameFilter($name);
     }
     foreach ($input->getOption('tags') as $tags) {
         $filters[] = new TagFilter($tags);
     }
     if ($role = $input->getOption('role')) {
         $filters[] = new RoleFilter($role);
     }
     if (count($filters)) {
         $this->gherkin->setFilters($filters);
     }
 }
Пример #2
0
 public function testSetFiltersOverridesAllFilters()
 {
     $gherkin = new Gherkin();
     $gherkin->addLoader($loader = $this->getLoaderMock());
     $gherkin->addFilter($nameFilter = $this->getNameFilterMock());
     $gherkin->setFilters(array());
     $feature = new FeatureNode(null, null, array(), null, array(), null, null, null, null);
     $loader->expects($this->once())->method('supports')->with($resource = 'some/feature/resource')->will($this->returnValue(true));
     $loader->expects($this->once())->method('load')->with($resource)->will($this->returnValue(array($feature)));
     $nameFilter->expects($this->never())->method('filterFeature');
     $nameFilter->expects($this->never())->method('isFeatureMatch');
     $features = $gherkin->load($resource);
     $this->assertEquals(1, count($features));
 }