1 | <?php |
||
9 | class ParserExceptionsTest extends \PHPUnit_Framework_TestCase |
||
10 | { |
||
11 | /** |
||
12 | * @var Parser |
||
13 | */ |
||
14 | private $gherkin; |
||
15 | |||
16 | protected function setUp() |
||
17 | { |
||
18 | $keywords = new ArrayKeywords(array( |
||
19 | 'en' => array( |
||
20 | 'feature' => 'Feature', |
||
21 | 'background' => 'Background', |
||
22 | 'scenario' => 'Scenario', |
||
23 | 'scenario_outline' => 'Scenario Outline', |
||
24 | 'examples' => 'Examples', |
||
25 | 'given' => 'Given', |
||
26 | 'when' => 'When', |
||
27 | 'then' => 'Then', |
||
28 | 'and' => 'And', |
||
29 | 'but' => 'But' |
||
30 | ), |
||
31 | 'ru' => array( |
||
32 | 'feature' => 'Функционал', |
||
33 | 'background' => 'Предыстория', |
||
34 | 'scenario' => 'Сценарий', |
||
35 | 'scenario_outline' => 'Структура сценария', |
||
36 | 'examples' => 'Значения', |
||
37 | 'given' => 'Допустим', |
||
38 | 'when' => 'То', |
||
39 | 'then' => 'Если', |
||
40 | 'and' => 'И', |
||
41 | 'but' => 'Но' |
||
42 | ) |
||
43 | )); |
||
44 | $this->gherkin = new Parser(new Lexer($keywords)); |
||
45 | } |
||
46 | |||
47 | public function testStepRightAfterFeature() |
||
48 | { |
||
49 | $feature = <<<GHERKIN |
||
50 | Feature: Some feature |
||
51 | |||
52 | Given some step-like line |
||
53 | GHERKIN; |
||
54 | |||
55 | $parsed = $this->gherkin->parse($feature); |
||
56 | |||
57 | $this->assertEquals("\n Given some step-like line", $parsed->getDescription()); |
||
58 | } |
||
59 | |||
60 | public function testTextInBackground() |
||
61 | { |
||
62 | $feature = <<<GHERKIN |
||
63 | Feature: Behat bug test |
||
64 | Background: remove X to couse bug |
||
65 | Step is red form is not valid |
||
66 | asd |
||
67 | asd |
||
68 | as |
||
69 | da |
||
70 | sd |
||
71 | as |
||
72 | das |
||
73 | d |
||
74 | |||
75 | |||
76 | Scenario: bug user edit date |
||
77 | GHERKIN; |
||
78 | |||
79 | $this->gherkin->parse($feature); |
||
80 | } |
||
81 | |||
82 | public function testTextInScenario() |
||
143 | |||
144 | /** |
||
145 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
146 | */ |
||
147 | public function testAmbigiousLanguage() |
||
161 | |||
162 | /** |
||
163 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
164 | */ |
||
165 | public function testEmptyOutline() |
||
175 | |||
176 | /** |
||
177 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
178 | */ |
||
179 | public function testWrongTagPlacement() |
||
192 | |||
193 | /** |
||
194 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
195 | */ |
||
196 | public function testBackgroundWithTag() |
||
208 | |||
209 | /** |
||
210 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
211 | */ |
||
212 | public function testEndlessPyString() |
||
225 | |||
226 | /** |
||
227 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
228 | */ |
||
229 | public function testWrongStepType() |
||
242 | |||
243 | /** |
||
244 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
245 | */ |
||
246 | public function testMultipleBackgrounds() |
||
260 | |||
261 | /** |
||
262 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
263 | */ |
||
264 | public function testMultipleFeatures() |
||
265 | { |
||
266 | $feature = <<<GHERKIN |
||
267 | Feature: |
||
268 | |||
269 | Feature: |
||
270 | GHERKIN; |
||
271 | |||
272 | $this->gherkin->parse($feature); |
||
273 | } |
||
274 | |||
275 | /** |
||
276 | * @expectedException \Behat\Gherkin\Exception\ParserException |
||
277 | */ |
||
278 | public function testTableWithoutRightBorder() |
||
291 | } |
||
292 |