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\Configuration; |
||
4 | |||
5 | use Hateoas\Tests\TestCase; |
||
6 | use Hateoas\Configuration\Relation; |
||
7 | |||
8 | class RelationTest extends TestCase |
||
9 | { |
||
10 | public function testConstructor() |
||
11 | { |
||
12 | $relation = new Relation('self', 'user_get'); |
||
13 | |||
14 | $this |
||
0 ignored issues
–
show
|
|||
15 | ->object($relation) |
||
16 | ->isInstanceOf('Hateoas\Configuration\Relation') |
||
17 | ->string($relation->getName()) |
||
18 | ->isEqualTo('self') |
||
19 | ->string($relation->getHref()) |
||
20 | ->isEqualTo('user_get') |
||
21 | ->array($relation->getAttributes()) |
||
22 | ->isEmpty() |
||
23 | ; |
||
24 | } |
||
25 | |||
26 | public function requireHrefOrEmbed() |
||
27 | { |
||
28 | $this |
||
29 | ->exception(function () { |
||
30 | new Relation('', null, null); |
||
31 | }) |
||
32 | ->isInstanceOf('InvalidArgumentException') |
||
33 | ->hasMessage('$href and $embedded cannot be both null.') |
||
34 | ; |
||
35 | } |
||
36 | |||
37 | public function canBeConstructedWithOnlyAnEmbed() |
||
38 | { |
||
39 | $relation = new Relation('self', null, 'foo'); |
||
40 | |||
41 | $this |
||
0 ignored issues
–
show
The method
string() does not exist on mageekguy\atoum\asserters\object . 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...
|
|||
42 | ->object($relation) |
||
43 | ->isInstanceOf('Hateoas\Configuration\Relation') |
||
44 | ->string($relation->getName()) |
||
45 | ->isEqualTo('self') |
||
46 | ->variable($relation->getHref()) |
||
47 | ->isNull() |
||
48 | ->object($relation->getEmbed()) |
||
0 ignored issues
–
show
The method
getEmbed() does not exist on Hateoas\Configuration\Relation . Did you maybe mean getEmbedded() ?
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...
|
|||
49 | ->isInstanceOf('Hateoas\Configuration\Embed') |
||
50 | ->variable($relation->getEmbed()->getContent()) |
||
0 ignored issues
–
show
The method
getEmbed() does not exist on Hateoas\Configuration\Relation . Did you maybe mean getEmbedded() ?
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...
|
|||
51 | ->isEqualTo('foo') |
||
52 | ; |
||
53 | } |
||
54 | } |
||
55 |
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.