Code Duplication    Length = 18-20 lines in 3 locations

tests/HeadTest.php 1 location

@@ 7-26 (lines=20) @@
4
5
use function Prelude\head;
6
7
class HeadTest extends \PHPUnit\Framework\TestCase
8
{
9
    /**
10
     * @test
11
     */
12
    public function shouldReturnTheFirstArgument()
13
    {
14
        $this->assertEquals(1, head([1, 2, 3]));
15
        $this->assertEquals(1, head(['a' => 1, 'b' => 2, 'c' => 3]));
16
    }
17
18
    /**
19
     * @test
20
     * @expectedException \Prelude\Exception\EmptyListException
21
     */
22
    public function shouldThrowEmptyListException()
23
    {
24
        head([]);
25
    }
26
}
27

tests/LastTest.php 1 location

@@ 7-26 (lines=20) @@
4
5
use function Prelude\last;
6
7
class LastTest extends \PHPUnit\Framework\TestCase
8
{
9
    /**
10
     * @test
11
     */
12
    public function test()
13
    {
14
        $this->assertEquals(3, last([1, 2, 3]));
15
        $this->assertEquals(3, last(['a' => 1, 'b' => 2, 'c' => 3]));
16
    }
17
18
    /**
19
     * @test
20
     * @expectedException \Prelude\Exception\EmptyListException
21
     */
22
    public function shouldThrowEmptyListException()
23
    {
24
        last([]);
25
    }
26
}
27

tests/PropTest.php 1 location

@@ 7-24 (lines=18) @@
4
5
use function Prelude\prop;
6
7
class PropTest extends \PHPUnit\Framework\TestCase
8
{
9
    /**
10
     * @test
11
     */
12
    public function shouldReturnValue()
13
    {
14
        $this->assertEquals('a', prop('a')(['a' => 'a', 'b' => 'b']));
15
    }
16
17
    /**
18
     * @test
19
     */
20
    public function shouldReturnNull()
21
    {
22
        $this->assertEquals(null, prop('z')(['a' => 'a', 'b' => 'b']));
23
    }
24
}
25