Behat\Gherkin\Filter\PathsFilter::isFeatureMatch PHP Method

isFeatureMatch() public method

Checks if Feature matches specified filter.
public isFeatureMatch ( Behat\Gherkin\Node\FeatureNode $feature ) : boolean
$feature Behat\Gherkin\Node\FeatureNode Feature instance
return boolean
    public function isFeatureMatch(FeatureNode $feature)
    {
        foreach ($this->filterPaths as $path) {
            if (0 === strpos($feature->getFile(), $path)) {
                return true;
            }
        }
        return false;
    }

Usage Example

Example #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));
 }
All Usage Examples Of Behat\Gherkin\Filter\PathsFilter::isFeatureMatch