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->assertSame('self', $relation->getName()); |
||
15 | $this->assertSame('user_get', $relation->getHref()); |
||
16 | $this->assertEmpty($relation->getAttributes()); |
||
17 | } |
||
18 | |||
19 | public function requireHrefOrEmbed() |
||
20 | { |
||
21 | $this |
||
0 ignored issues
–
show
|
|||
22 | ->exception(function () { |
||
23 | new Relation('', null, null); |
||
24 | }) |
||
25 | ->isInstanceOf('InvalidArgumentException') |
||
26 | ->hasMessage('$href and $embedded cannot be both null.') |
||
27 | ; |
||
28 | } |
||
29 | |||
30 | public function canBeConstructedWithOnlyAnEmbed() |
||
31 | { |
||
32 | $relation = new Relation('self', null, 'foo'); |
||
33 | |||
34 | $this->assertSame('self', $relation->getName()); |
||
35 | $this->assertNull($relation->getHref()); |
||
36 | $this->assertEmpty($relation->getAttributes()); |
||
37 | $this->assertInstanceOf('Hateoas\Configuration\Embed', $relation->getEmbedded()); |
||
38 | $this->assertSame('foo', $relation->getEmbedded()->getContent()); |
||
39 | } |
||
40 | } |
||
41 |
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.