Total Complexity | 3 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class IterableLastTest extends TestCase |
||
12 | { |
||
13 | use ProvideIterablesTrait; |
||
14 | |||
15 | public function provider() |
||
16 | { |
||
17 | return $this->provideIterables(['one', 'two', 'three'], true); |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * @dataProvider provider |
||
22 | */ |
||
23 | public function test($values) |
||
24 | { |
||
25 | $result = iterable_last($values); |
||
26 | |||
27 | $this->assertEquals('three', $result); |
||
28 | } |
||
29 | |||
30 | public function testEmpty() |
||
31 | { |
||
32 | $result = iterable_last(new \EmptyIterator()); |
||
33 | |||
34 | $this->assertNull($result); |
||
35 | } |
||
37 |