Completed
Pull Request — master (#13)
by
unknown
03:54
created

PaginationLinksTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A itProvidePaginationFirstAndLastLinks() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ElevenLabs\Api\Service\Tests\Pagination;
6
7
use ElevenLabs\Api\Service\Pagination\PaginationLinks;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * Class PaginationLinksTest.
12
 */
13
class PaginationLinksTest extends TestCase
14
{
15
    /** @test */
16
    public function itProvidePaginationFirstAndLastLinks()
17
    {
18
        $links = new PaginationLinks(
19
            'http://domain.tld?page=1',
20
            'http://domain.tld?page=5'
21
        );
22
23
        $this->assertSame('http://domain.tld?page=1', $links->getFirst());
24
        $this->assertSame('http://domain.tld?page=5', $links->getLast());
25
        $this->assertFalse($links->hasNext());
26
        $this->assertFalse($links->hasPrev());
27
    }
28
29
    /** @test */
30
    public function itCanProvidePaginationNextAndPrevLinks()
31
    {
32
        $links = new PaginationLinks(
33
            'http://domain.tld?page=1',
34
            'http://domain.tld?page=5',
35
            'http://domain.tld?page=3',
36
            'http://domain.tld?page=2'
37
        );
38
39
        $this->assertTrue($links->hasNext());
40
        $this->assertTrue($links->hasPrev());
41
        $this->assertSame('http://domain.tld?page=3', $links->getNext());
42
        $this->assertSame('http://domain.tld?page=2', $links->getPrev());
43
    }
44
}
45