Completed
Pull Request — master (#112)
by Christophe
03:09
created

CachedArrayKeywordsTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSteps() 0 13 3
A getKeywords() 0 4 1
A getKeywordsArray() 0 4 1
1
<?php
2
3
namespace Tests\Behat\Gherkin\Keywords;
4
5
use Behat\Gherkin\Keywords\CachedArrayKeywords;
6
use Behat\Gherkin\Node\StepNode;
7
8
class CachedArrayKeywordsTest extends KeywordsTest
9
{
10
    protected function getKeywords()
11
    {
12
        return new CachedArrayKeywords(__DIR__ . '/../../../../i18n.php');
13
    }
14
15
    protected function getKeywordsArray()
16
    {
17
        return include(__DIR__ . '/../../../../i18n.php');
18
    }
19
20
    protected function getSteps($keywords, $text, &$line, $keywordType)
21
    {
22
        $steps = array();
23
        foreach (explode('|', $keywords) as $keyword) {
24
            if (false !== mb_strpos($keyword, '<')) {
25
                $keyword = mb_substr($keyword, 0, -1);
26
            }
27
28
            $steps[] = new StepNode($keyword, $text, array(), $line++, $keywordType);
29
        }
30
31
        return $steps;
32
    }
33
}
34