X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fgherkin%2Ftests%2FBehat%2FGherkin%2FFilter%2FPathsFilterTest.php;fp=vendor%2Fbehat%2Fgherkin%2Ftests%2FBehat%2FGherkin%2FFilter%2FPathsFilterTest.php;h=e106d734ff396dd790f5ed750207a4cb12356286;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/behat/gherkin/tests/Behat/Gherkin/Filter/PathsFilterTest.php b/vendor/behat/gherkin/tests/Behat/Gherkin/Filter/PathsFilterTest.php new file mode 100644 index 000000000..e106d734f --- /dev/null +++ b/vendor/behat/gherkin/tests/Behat/Gherkin/Filter/PathsFilterTest.php @@ -0,0 +1,58 @@ +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 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)); + } + + public function testItDoesNotMatchIfFileWithSameNameButNotPathExistsInFolder() + { + $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)); + } +}