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

tests/Hateoas/Tests/HateoasBuilderTest.php (1 issue)

Check for unknown method on object

Bug Major

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;
4
5
use Hateoas\HateoasBuilder;
6
use Hateoas\UrlGenerator\CallableUrlGenerator;
7
use JMS\Serializer\SerializationContext;
8
use Hateoas\Tests\Fixtures\AdrienBrault;
9
use Hateoas\Tests\Fixtures\WithAlternativeRouter;
10
11
/**
12
 * Contains functional tests
13
 */
14
class HateoasBuilderTest extends TestCase
15
{
16
    public function testBuild()
17
    {
18
        $hateoasBuilder = new HateoasBuilder();
19
        $hateoas = $hateoasBuilder->build();
20
21
        $this
22
            ->object($hateoas)
23
                ->isInstanceOf('Hateoas\Hateoas')
24
        ;
25
    }
26
27
    public function testSerializeAdrienBraultWithExclusion()
28
    {
29
        $hateoas = HateoasBuilder::buildHateoas();
30
31
        $adrienBrault     = new AdrienBrault();
32
        $fakeAdrienBrault = new AdrienBrault();
33
        $fakeAdrienBrault->firstName = 'John';
34
        $fakeAdrienBrault->lastName = 'Smith';
35
36
        $context  = SerializationContext::create()->setGroups(array('simple'));
37
        $context2 = clone $context;
38
39
        $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...
40
            ->string($hateoas->serialize($adrienBrault, 'xml', $context))
41
                ->isEqualTo(<<<XML
42
<?xml version="1.0" encoding="UTF-8"?>
43
<result>
44
  <first_name><![CDATA[Adrien]]></first_name>
45
  <last_name><![CDATA[Brault]]></last_name>
46
  <link rel="self" href="http://adrienbrault.fr"/>
47
  <link rel="computer" href="http://www.apple.com/macbook-pro/"/>
48
</result>
49
50
XML
51
                )
52
            ->string($hateoas->serialize($fakeAdrienBrault, 'xml', $context2))
53
                ->isEqualTo(<<<XML
54
<?xml version="1.0" encoding="UTF-8"?>
55
<result>
56
  <first_name><![CDATA[John]]></first_name>
57
  <last_name><![CDATA[Smith]]></last_name>
58
  <link rel="computer" href="http://www.apple.com/macbook-pro/"/>
59
</result>
60
61
XML
62
                )
63
        ;
64
    }
65
66
    public function testAlternativeUrlGenerator()
67
    {
68
        $brokenUrlGenerator = new CallableUrlGenerator(function ($name, $parameters) {
69
            return $name . '?' . http_build_query($parameters);
70
        });
71
72
        $hateoas = HateoasBuilder::create()
73
            ->setUrlGenerator('my_generator', $brokenUrlGenerator)
74
            ->build()
75
        ;
76
77
        $this
78
            ->string($hateoas->serialize(new WithAlternativeRouter(), 'xml'))
79
            ->isEqualTo(<<<XML
80
<?xml version="1.0" encoding="UTF-8"?>
81
<result>
82
  <link rel="search" href="/search?query=hello"/>
83
</result>
84
85
XML
86
            )
87
        ;
88
    }
89
}
90