Passed
Pull Request — master (#13)
by
unknown
02:44
created

itProvidePaginationFirstAndLastLinks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 11
rs 10
c 0
b 0
f 0
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