Completed
Push — master ( b27094...afbc6d )
by Julien
05:50 queued 01:38
created

testCreateHydraPaginatedCollection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

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