Автор: Konstantin Kudryashov (ever.zet@gmail.com)
Наследование: extends Behat\Gherkin\Filter\SimpleFilter
Пример #1
0
 public function testItDoesNotMatchPartialPaths()
 {
     $fixtures = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR;
     $feature = new FeatureNode(null, null, array(), null, array(), null, null, $fixtures . 'full_path' . DIRECTORY_SEPARATOR . 'file1', 1);
     $filter = new PathsFilter(array($fixtures . 'full'));
     $this->assertFalse($filter->isFeatureMatch($feature));
     $filter = new PathsFilter(array($fixtures . 'full' . DIRECTORY_SEPARATOR));
     $this->assertFalse($filter->isFeatureMatch($feature));
     $filter = new PathsFilter(array($fixtures . 'full_path' . DIRECTORY_SEPARATOR));
     $this->assertTrue($filter->isFeatureMatch($feature));
     $filter = new PathsFilter(array($fixtures . 'full_path'));
     $this->assertTrue($filter->isFeatureMatch($feature));
 }
Пример #2
0
 public function testIsFeatureMatchFilter()
 {
     $feature = new FeatureNode(null, null, array(), null, array(), null, null, __FILE__, 1);
     $filter = new PathsFilter(array(__DIR__));
     $this->assertTrue($filter->isFeatureMatch($feature));
     $filter = new PathsFilter(array('/abc', '/def', dirname(__DIR__)));
     $this->assertTrue($filter->isFeatureMatch($feature));
     $filter = new PathsFilter(array('/abc', '/def', __DIR__));
     $this->assertTrue($filter->isFeatureMatch($feature));
     $filter = new PathsFilter(array('/abc', __DIR__, '/def'));
     $this->assertTrue($filter->isFeatureMatch($feature));
     $filter = new PathsFilter(array('/abc', '/def', '/wrong/path'));
     $this->assertFalse($filter->isFeatureMatch($feature));
 }
 public function testIsScenarioMatchFilter()
 {
     $feature = new Node\FeatureNode(null, null, '/some/path/with/some.feature', 1);
     $scenario = new Node\ScenarioNode(null, 2);
     $scenario->setFeature($feature);
     $filter = new PathsFilter(array('/some'));
     $this->assertTrue($filter->isScenarioMatch($scenario));
     $filter = new PathsFilter(array('/abc', '/def', '/some'));
     $this->assertTrue($filter->isScenarioMatch($scenario));
     $filter = new PathsFilter(array('/abc', '/def', '/some/path'));
     $this->assertTrue($filter->isScenarioMatch($scenario));
     $filter = new PathsFilter(array('/abc', '/some/path', '/def'));
     $this->assertTrue($filter->isScenarioMatch($scenario));
     $filter = new PathsFilter(array('/abc', '/def', '/wrong/path'));
     $this->assertFalse($filter->isScenarioMatch($scenario));
 }