Failed Conditions
Branch master (01ba0d)
by Arnold
06:58 queued 01:45
created

IterableLastTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3
1
<?php
2
3
namespace Jasny\Tests;
4
5
use PHPUnit\Framework\TestCase;
6
use function Jasny\iterable_last;
7
8
/**
9
 * @covers \Jasny\iterable_last
10
 */
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
    }
36
}
37