CucumberKeywordsTest::getSteps()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 3
nc 3
nop 4
1
<?php
2
3
namespace Tests\Behat\Gherkin\Keywords;
4
5
use Behat\Gherkin\Keywords\CucumberKeywords;
6
use Behat\Gherkin\Node\StepNode;
7
use Symfony\Component\Yaml\Yaml;
8
9
class CucumberKeywordsTest extends KeywordsTest
10
{
11
    protected function getKeywords()
12
    {
13
        return new CucumberKeywords(__DIR__ . '/../Fixtures/i18n.yml');
14
    }
15
16
    protected function getKeywordsArray()
17
    {
18
        return Yaml::parse(file_get_contents(__DIR__ . '/../Fixtures/i18n.yml'));
19
    }
20
21
    protected function getSteps($keywords, $text, &$line, $keywordType)
22
    {
23
        $steps = array();
24
        foreach (explode('|', mb_substr($keywords, 2)) as $keyword) {
25
            if (false !== mb_strpos($keyword, '<')) {
26
                $keyword = mb_substr($keyword, 0, -1);
27
            }
28
29
            $steps[] = new StepNode($keyword, $text, array(), $line++, $keywordType);
30
        }
31
32
        return $steps;
33
    }
34
}
35