Completed
Pull Request — master (#53)
by Julien
02:22
created

HalCollection::testCreateHalCollection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.3142
c 0
b 0
f 0
cc 1
eloc 14
nc 1
nop 0
1
<?php
2
3
namespace Mapado\RestClientSdk\Tests\Units\Collection;
4
5
use atoum;
6
7
/**
8
 * HalCollection
9
 *
10
 * @uses   atoum
11
 * @author Florent Clerc <[email protected]>
12
 */
13
class HalCollection extends atoum
14
{
15
16
    /**
17
     * testCreateHydraPaginatedCollection
18
     *
19
     * @access public
20
     * @return void
21
     */
22
    public function testCreateHalCollection()
23
    {
24
        $json = json_decode(file_get_contents(__DIR__ . '/../../data/orderList.hal.json'), true);
25
26
        $this
27
            ->given($collection = $this->newTestedInstance($json['_embedded']['ea:order'], $json))
28
29
            ->then
30
            ->object($collection)
31
                ->isInstanceOf('Mapado\RestClientSdk\Collection\HalCollection')
32
                ->hasSize(2)
33
34
            ->and
35
            ->array($collection->getLinks())
36
                ->size->isEqualTo(5)
37
38
            ->and
39
            ->string($collection->getLinks()['self']['href'])
40
                ->isEqualTo('/orders')
41
        ;
42
    }
43
}
44