NarrativeFilterTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testIsFeatureMatchFilter() 0 24 1
1
<?php
2
3
namespace Tests\Behat\Gherkin\Filter;
4
5
use Behat\Gherkin\Filter\NarrativeFilter;
6
use Behat\Gherkin\Node\FeatureNode;
7
8
class NarrativeFilterTest extends FilterTest
9
{
10
    public function testIsFeatureMatchFilter()
11
    {
12
        $description = <<<NAR
13
In order to be able to read news in my own language
14
As a french user
15
I need to be able to switch website language to french
16
NAR;
17
        $feature = new FeatureNode(null, $description, array(), null, array(), null, null, null, 1);
18
19
        $filter = new NarrativeFilter('/as (?:a|an) french user/');
20
        $this->assertFalse($filter->isFeatureMatch($feature));
21
22
        $filter = new NarrativeFilter('/as (?:a|an) french user/i');
23
        $this->assertTrue($filter->isFeatureMatch($feature));
24
25
        $filter = new NarrativeFilter('/french .*/');
26
        $this->assertTrue($filter->isFeatureMatch($feature));
27
28
        $filter = new NarrativeFilter('/^french/');
29
        $this->assertFalse($filter->isFeatureMatch($feature));
30
31
        $filter = new NarrativeFilter('/user$/');
32
        $this->assertFalse($filter->isFeatureMatch($feature));
33
    }
34
}
35