HalCollection   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

1 Method

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