Completed
Push — master ( c92e14...29c633 )
by Pol
130:15
created

NGramsCyclicSpec   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
cbo 1
dl 0
loc 89
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace spec\drupol\phpngrams;
4
5
use drupol\phpngrams\NGramsCyclic;
6
use PhpSpec\ObjectBehavior;
7
8
class NGramsCyclicSpec extends ObjectBehavior
9
{
10
    public function it_is_initializable()
11
    {
12
        $this->shouldHaveType(NGramsCyclic::class);
13
    }
14
15
    public function it_can_get_ngram_from_an_array_without_cycling()
16
    {
17
        $result = [
18
            ['h', 'e', 'l', 'l'],
19
            ['e', 'l', 'l', 'o'],
20
            ['l', 'l', 'o', ' '],
21
            ['l', 'o', ' ', 'w'],
22
            ['o', ' ', 'w', 'o'],
23
            [' ', 'w', 'o', 'r'],
24
            ['w', 'o', 'r', 'l'],
25
            ['o', 'r', 'l', 'd'],
26
            ['r', 'l', 'd', 'h'],
27
            ['l', 'd', 'h', 'e'],
28
            ['d', 'h', 'e', 'l'],
29
        ];
30
31
        $this->ngrams(['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'], 4)->shouldIterateAs(new \ArrayIterator($result));
32
    }
33
}
34