Total Complexity | 4 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php namespace Chekote\NounStore\Key; |
||
9 | class BuildTest extends KeyTest |
||
10 | { |
||
11 | public function setUp() |
||
12 | { |
||
13 | parent::setUp(); |
||
14 | |||
15 | /* @noinspection PhpUndefinedMethodInspection */ |
||
16 | Phake::when($this->key)->build(Phake::anyParameters())->thenCallParent(); |
||
|
|||
17 | } |
||
18 | |||
19 | public function testNullIndexReturnsUnmodifiedKey() |
||
20 | { |
||
21 | $key = 'Thing'; |
||
22 | |||
23 | $this->assertEquals($key, $this->key->build($key, null)); |
||
24 | } |
||
25 | |||
26 | public function testNonNullIndexReturnsModifiedKey() |
||
27 | { |
||
28 | $key = 'Thing'; |
||
29 | $index = 9; |
||
30 | $nth = $index + 1; |
||
31 | |||
32 | /* @noinspection PhpUndefinedMethodInspection */ |
||
33 | Phake::when($this->key)->getOrdinal($nth)->thenReturn('th'); |
||
34 | |||
35 | $this->assertEquals('10th Thing', $this->key->build($key, $index)); |
||
36 | |||
37 | /* @noinspection PhpUndefinedMethodInspection */ |
||
38 | Phake::verify($this->key)->getOrdinal($nth); |
||
39 | } |
||
40 | |||
41 | public function testInvalidArgumentExceptionBubblesUpFromGetOrdinal() |
||
58 | } |
||
59 | } |
||
60 |