Completed
Pull Request — master (#112)
by Christophe
02:50
created

FilterTest::getParsedFeature()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
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
9
abstract class FilterTest extends \PHPUnit_Framework_TestCase
10
{
11
    protected function getParser()
12
    {
13
        return new Parser(
14
            new Lexer(
15
                new ArrayKeywords(array(
16
                    'en' => array(
17
                        'feature'          => 'Feature',
18
                        'background'       => 'Background',
19
                        'scenario'         => 'Scenario',
20
                        'scenario_outline' => 'Scenario Outline|Scenario Template',
21
                        'examples'         => 'Examples|Scenarios',
22
                        'given'            => 'Given',
23
                        'when'             => 'When',
24
                        'then'             => 'Then',
25
                        'and'              => 'And',
26
                        'but'              => 'But'
27
                    )
28
                ))
29
            )
30
        );
31
    }
32
33
    protected function getGherkinFeature()
34
    {
35
        return <<<GHERKIN
36
Feature: Long feature with outline
37
  Scenario: Scenario#1
38
    Given initial step
39
    When action occurs
40
    Then outcomes should be visible
41
42
  Scenario: Scenario#2
43
    Given initial step
44
    And another initial step
45
    When action occurs
46
    Then outcomes should be visible
47
48
  Scenario Outline: Scenario#3
49
    When <action> occurs
50
    Then <outcome> should be visible
51
52
    Examples:
53
      | action | outcome |
54
      | act#1  | out#1   |
55
      | act#2  | out#2   |
56
      | act#3  | out#3   |
57
GHERKIN;
58
    }
59
60
    protected function getParsedFeature()
61
    {
62
        return $this->getParser()->parse($this->getGherkinFeature());
63
    }
64
}
65