GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 1978d2...e2f699 )
by William
03:55
created

Representation/CollectionRepresentationTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Hateoas\Tests\Representation;
4
5
use Hateoas\Configuration\Relation;
6
use Hateoas\Configuration\Route;
7
use Hateoas\Representation\CollectionRepresentation;
8
9
class CollectionRepresentationTest extends RepresentationTestCase
10
{
11
    /**
12
     * @dataProvider getTestSerializeData
13
     */
14
    public function testSerialize($resources)
15
    {
16
        $collection = new CollectionRepresentation(
17
            $resources,
18
            'authors'
19
        );
20
        $collection->setXmlElementName('users');
21
22
        $this
23
            ->string($this->hateoas->serialize($collection, 'xml'))
24
            ->isEqualTo(<<<XML
25
<?xml version="1.0" encoding="UTF-8"?>
26
<collection>
27
  <users rel="authors">
28
    <entry><![CDATA[Adrien]]></entry>
29
    <entry><![CDATA[William]]></entry>
30
  </users>
31
</collection>
32
33
XML
34
            )
35
            ->string($this->halHateoas->serialize($collection, 'xml'))
36
            ->isEqualTo(<<<XML
37
<?xml version="1.0" encoding="UTF-8"?>
38
<collection>
39
  <resource rel="authors"><![CDATA[Adrien]]></resource>
40
  <resource rel="authors"><![CDATA[William]]></resource>
41
</collection>
42
43
XML
44
            );
45
46
        $this
47
            ->json($this->halHateoas->serialize($collection, 'json'))
48
            ->isEqualTo(<<<JSON
49
{
50
    "_embedded": {
51
        "authors": [
52
            "Adrien",
53
            "William"
54
        ]
55
    }
56
}
57
JSON
58
        );
59
    }
60
61
    public function getTestSerializeData()
62
    {
63
        return array(
64
            array(
65
                array(
66
                    'Adrien',
67
                    'William',
68
                )
69
            ),
70
            array(
71
                new \ArrayIterator(array(
72
                    'Adrien',
73
                    'William',
74
                ))
75
            ),
76
        );
77
    }
78
79
    public function testEmbeddedRelationIsMergedWithCustomRelations()
80
    {
81
        $collection = new CollectionRepresentation(
82
            array(
83
                'Adrien',
84
                'William',
85
            ),
86
            'authors',
87
            null,
88
            null,
89
            null,
90
            array(
91
                new Relation(
92
                    'custom',
93
                    new Route('/custom')
94
                ),
95
            )
96
        );
97
        $collection->setXmlElementName('users');
98
99
        $this
0 ignored issues
show
The method string() does not exist on mageekguy\atoum\asserters\string. Did you maybe mean __toString()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
100
            ->string($this->hateoas->serialize($collection, 'xml'))
101
            ->isEqualTo(<<<XML
102
<?xml version="1.0" encoding="UTF-8"?>
103
<collection>
104
  <link rel="custom" href="/custom"/>
105
  <users rel="authors">
106
    <entry><![CDATA[Adrien]]></entry>
107
    <entry><![CDATA[William]]></entry>
108
  </users>
109
</collection>
110
111
XML
112
            )
113
            ->string($this->halHateoas->serialize($collection, 'xml'))
114
            ->isEqualTo(<<<XML
115
<?xml version="1.0" encoding="UTF-8"?>
116
<collection>
117
  <link rel="custom" href="/custom"/>
118
  <resource rel="authors"><![CDATA[Adrien]]></resource>
119
  <resource rel="authors"><![CDATA[William]]></resource>
120
</collection>
121
122
XML
123
            );
124
125
        $this
126
            ->json($this->halHateoas->serialize($collection, 'json'))
127
            ->isEqualTo(<<<JSON
128
{
129
    "_links": {
130
        "custom": {
131
            "href": "\/custom"
132
        }
133
    },
134
    "_embedded": {
135
        "authors": [
136
            "Adrien",
137
            "William"
138
        ]
139
    }
140
}
141
JSON
142
            );
143
    }
144
}
145