itProvidePaginationFirstAndLastLinks()   A
last analyzed

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
namespace ElevenLabs\Api\Service\Pagination;
3
4
use PHPUnit\Framework\TestCase;
5
6
class PaginationLinksTest extends TestCase
7
{
8
    /** @test */
9
    public function itProvidePaginationFirstAndLastLinks()
10
    {
11
        $links = new PaginationLinks(
12
            'http://domain.tld?page=1',
13
            'http://domain.tld?page=5'
14
        );
15
16
        assertThat($links->getFirst(), equalTo('http://domain.tld?page=1'));
17
        assertThat($links->getLast(), equalTo('http://domain.tld?page=5'));
18
        assertThat($links->hasNext(), isFalse());
19
        assertThat($links->hasPrev(), isFalse());
20
    }
21
22
    /** @test */
23
    public function itCanProvidePaginationNextAndPrevLinks()
24
    {
25
        $links = new PaginationLinks(
26
            'http://domain.tld?page=1',
27
            'http://domain.tld?page=5',
28
            'http://domain.tld?page=3',
29
            'http://domain.tld?page=2'
30
        );
31
32
        assertThat($links->hasNext(), isTrue());
33
        assertThat($links->hasPrev(), isTrue());
34
        assertThat($links->getNext(), equalTo('http://domain.tld?page=3'));
35
        assertThat($links->getPrev(), equalTo('http://domain.tld?page=2'));
36
    }
37
}
38