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.

XmlHalSerializerTest::testSerializeAdrienBrault()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 35
c 1
b 0
f 0
rs 8.8571
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
namespace Hateoas\Tests\Serializer;
4
5
use Hateoas\HateoasBuilder;
6
use Hateoas\Representation\CollectionRepresentation;
7
use Hateoas\Serializer\XmlHalSerializer;
8
use Hateoas\Tests\Fixtures\AdrienBrault;
9
use Hateoas\Tests\Fixtures\Gh236Foo;
10
use Hateoas\Tests\TestCase;
11
use JMS\Serializer\SerializationContext;
12
13
class XmlHalSerializerTest extends TestCase
14
{
15
    public function testSerializeAdrienBrault()
16
    {
17
        $hateoas = HateoasBuilder::create()
18
            ->setXmlSerializer(new XmlHalSerializer())
19
            ->build();
20
        $adrienBrault = new AdrienBrault();
21
22
        $this->assertSame(
23
            <<<XML
24
<?xml version="1.0" encoding="UTF-8"?>
25
<result href="http://adrienbrault.fr">
26
  <first_name><![CDATA[Adrien]]></first_name>
27
  <last_name><![CDATA[Brault]]></last_name>
28
  <link rel="computer" href="http://www.apple.com/macbook-pro/"/>
29
  <link rel="dynamic-relation" href="awesome!!!"/>
30
  <resource rel="computer">
31
    <name><![CDATA[MacBook Pro]]></name>
32
  </resource>
33
  <resource rel="broken-computer">
34
    <name><![CDATA[Windows Computer]]></name>
35
  </resource>
36
  <resource rel="smartphone">
37
    <name><![CDATA[iPhone 6]]></name>
38
  </resource>
39
  <resource rel="smartphone">
40
    <name><![CDATA[Nexus 5]]></name>
41
  </resource>
42
  <resource rel="dynamic-relation"><![CDATA[wowowow]]></resource>
43
</result>
44
45
XML
46
            ,
47
            $hateoas->serialize($adrienBrault, 'xml')
48
        );
49
    }
50
51 View Code Duplication
    public function testGh236()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
52
    {
53
        $data = new CollectionRepresentation([new Gh236Foo()]);
54
55
        $hateoas = HateoasBuilder::create()
56
            ->setXmlSerializer(new XmlHalSerializer())
57
            ->build();
58
59
        $this->assertSame(
60
            <<<XML
61
<?xml version="1.0" encoding="UTF-8"?>
62
<collection>
63
  <resource rel="items">
64
    <a>
65
      <xxx><![CDATA[yyy]]></xxx>
66
    </a>
67
    <resource rel="b_embed">
68
      <xxx><![CDATA[zzz]]></xxx>
69
    </resource>
70
  </resource>
71
</collection>
72
73
XML
74
            ,
75
            $hateoas->serialize($data, 'xml', SerializationContext::create()->enableMaxDepthChecks())
76
        );
77
    }
78
}
79