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

CucumberKeywordsTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 26
wmc 5
lcom 0
cbo 4
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getKeywordsArray() 0 4 1
A getSteps() 0 13 3
A getKeywords() 0 4 1
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