FilterTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 62
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getParser() 0 21 1
A getGherkinFeature() 0 32 1
A getParsedFeature() 0 4 1
1
<?php
2
3
namespace Tests\Behat\Gherkin\Filter;
4
5
use Behat\Gherkin\Keywords\ArrayKeywords;
6
use Behat\Gherkin\Lexer;
7
use Behat\Gherkin\Parser;
8
use PHPUnit\Framework\TestCase;
9
10
abstract class FilterTest extends TestCase
11
{
12
    protected function getParser()
13
    {
14
        return new Parser(
15
            new Lexer(
16
                new ArrayKeywords(array(
17
                    'en' => array(
18
                        'feature'          => 'Feature',
19
                        'background'       => 'Background',
20
                        'scenario'         => 'Scenario',
21
                        'scenario_outline' => 'Scenario Outline|Scenario Template',
22
                        'examples'         => 'Examples|Scenarios',
23
                        'given'            => 'Given',
24
                        'when'             => 'When',
25
                        'then'             => 'Then',
26
                        'and'              => 'And',
27
                        'but'              => 'But'
28
                    )
29
                ))
30
            )
31
        );
32
    }
33
34
    protected function getGherkinFeature()
35
    {
36
        return <<<GHERKIN
37
Feature: Long feature with outline
38
  Scenario: Scenario#1
39
    Given initial step
40
    When action occurs
41
    Then outcomes should be visible
42
43
  Scenario: Scenario#2
44
    Given initial step
45
    And another initial step
46
    When action occurs
47
    Then outcomes should be visible
48
49
  Scenario Outline: Scenario#3
50
    When <action> occurs
51
    Then <outcome> should be visible
52
53
    @etag1
54
    Examples:
55
      | action | outcome |
56
      | act#1  | out#1   |
57
      | act#2  | out#2   |
58
      
59
    @etag2
60
    Examples:
61
      | action | outcome |
62
      | act#3  | out#3   |
63
64
GHERKIN;
65
    }
66
67
    protected function getParsedFeature()
68
    {
69
        return $this->getParser()->parse($this->getGherkinFeature());
70
    }
71
}
72