HydraPaginatedCollection   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCreateHydraPaginatedCollection() 0 22 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Mapado\RestClientSdk\Tests\Units\Collection;
6
7
use atoum;
8
9
/**
10
 * HydraPaginatedCollection
11
 *
12
 * @uses   \atoum
13
 *
14
 * @author Florent Clerc <[email protected]>
15
 */
16
class HydraPaginatedCollection extends atoum
17
{
18
    /**
19
     * testCreateHydraPaginatedCollection
20
     */
21
    public function testCreateHydraPaginatedCollection()
22
    {
23
        $json = json_decode(file_get_contents(__DIR__ . '/../../data/ticketing.list.paginated.json'), true);
24
25
        $this
26
            ->given($collection = new \Mapado\RestClientSdk\Collection\HydraPaginatedCollection($json['hydra:member'], $json))
27
28
            ->then
29
            ->object($collection)
30
            ->isInstanceOf('Mapado\RestClientSdk\Collection\HydraPaginatedCollection')
31
            ->isInstanceOf('\Traversable')
32
            ->hasSize(2)
33
            ->and
34
            ->integer($collection->getTotalItems())->isEqualTo(6)
35
            ->and
36
            ->array($collection->toArray())->isEqualTo($json['hydra:member'])
37
            ->and
38
            ->variable($collection->getFirstPage())->isEqualTo($json['hydra:firstPage'])
39
            ->and
40
            ->variable($collection->getLastPage())->isEqualTo($json['hydra:lastPage'])
41
            ->and
42
            ->variable($collection->getNextPage())->isEqualTo($json['hydra:nextPage']);
43
    }
44
}
45