Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function testHasMethod() |
||
29 | { |
||
30 | $tagDoctrine = new Tag('Doctrine'); |
||
31 | $tagNette = new Tag('Nette'); |
||
32 | |||
33 | $category = new Category('Some name', TRUE); |
||
34 | $category->addTag($tagDoctrine); |
||
35 | $category->addTag($tagNette); |
||
36 | |||
37 | $this->assertInstanceOf(ArrayCollection::class, $category->getTags()); |
||
38 | $this->assertSame(2, $category->getTags()->count()); |
||
39 | $this->assertTrue($category->hasTag($tagNette)); |
||
40 | } |
||
41 | |||
52 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: