1 | <?php |
||
7 | class ReferenceTest extends \PHPUnit_Framework_TestCase { |
||
8 | |||
9 | /** |
||
10 | * @var Reference |
||
11 | */ |
||
12 | protected $object; |
||
13 | |||
14 | /** |
||
15 | */ |
||
16 | protected function setUp() { |
||
19 | |||
20 | protected function getContainer() { |
||
21 | $container = new Container(); |
||
22 | $container->set('test.param', 'parameterValue'); |
||
23 | $container->set('callable', function($c) { return 'callValue'; }); |
||
24 | $container->set('shared', function($c) { $a = new \stdClass(); $a->mt = microtime(true); return $a; }, true); |
||
|
|||
25 | |||
26 | return $container; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | */ |
||
31 | public function testGetterAndSetter() { |
||
32 | $this->assertEquals("testRef", $this->object->getName()); |
||
33 | $this->object->setName("testRefName"); |
||
34 | $this->assertEquals("testRefName", $this->object->getName()); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | */ |
||
39 | public function test__toString(){ |
||
42 | |||
43 | public function testBasicInvocation() |
||
44 | { |
||
48 | |||
49 | public function testInvocationError() |
||
54 | } |
||
55 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.