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

HalCollection   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 31
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCreateHalCollection() 0 21 1
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