1 | <?php |
||
8 | class CopyResourceCommandTest extends \PHPUnit_Framework_TestCase |
||
9 | { |
||
10 | /** |
||
11 | * @var ResourceDO |
||
12 | */ |
||
13 | protected $resourceDO; |
||
14 | /** |
||
15 | * @var Filesystem |
||
16 | */ |
||
17 | protected $filesystem; |
||
18 | |||
19 | 8 | protected function setUp() |
|
25 | |||
26 | /** |
||
27 | * @return CopyResourceCommand |
||
28 | */ |
||
29 | 8 | public function getCommand(ResourceDO $resourceDOSource, ResourceDO $resourceDODest) |
|
33 | |||
34 | /** |
||
35 | * @return ResourceDO |
||
36 | */ |
||
37 | 2 | public function getResourceDO() |
|
41 | |||
42 | /** |
||
43 | * @return ResourceDO |
||
44 | */ |
||
45 | 7 | public function getResourceDOMock() |
|
55 | |||
56 | /** |
||
57 | * @expectedException \Staticus\Resources\Exceptions\CommandErrorException |
||
58 | * @expectedExceptionMessage Source resource cannot be empty |
||
59 | */ |
||
60 | 1 | public function testCopyEmptySourceResource() |
|
61 | { |
||
62 | 1 | $resourceDOSource = $this->getResourceDO(); |
|
63 | 1 | $resourceDODest = $this->getResourceDO(); |
|
64 | 1 | $command = $this->getCommand($resourceDOSource, $resourceDODest); |
|
65 | 1 | $command(); |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * @expectedException \Staticus\Resources\Exceptions\CommandErrorException |
||
70 | * @expectedExceptionMessage Destination resource cannot be empty |
||
71 | */ |
||
72 | 1 | public function testCopyEmptyDestinationResource() |
|
73 | { |
||
74 | 1 | $resourceDOSource = $this->getResourceDOMock(); |
|
75 | 1 | $resourceDODest = $this->getResourceDO(); |
|
76 | 1 | $command = $this->getCommand($resourceDOSource, $resourceDODest); |
|
77 | 1 | $command(); |
|
78 | } |
||
79 | |||
80 | /** |
||
81 | * @expectedException \Staticus\Resources\Exceptions\CommandErrorException |
||
82 | * @expectedExceptionMessage Origin file is not exists: testBase/testType/def/def/0/c9f/c9f7e81bafc626421e04b573022e6203.testType |
||
83 | */ |
||
84 | 1 | public function testCopyResourceNotExists() |
|
93 | |||
94 | /** |
||
95 | * @expectedException \Staticus\Resources\Exceptions\CommandErrorException |
||
96 | * @expectedExceptionMessage Source and destination paths is equal |
||
97 | */ |
||
98 | 1 | public function testCopyResourceToItself() |
|
107 | |||
108 | 1 | public function testCopyResourceNormal() |
|
121 | |||
122 | 1 | public function testCopyResourceToExists() |
|
135 | |||
136 | 1 | public function testReplaceNotExistsCopy() |
|
137 | { |
||
150 | |||
151 | 1 | public function testReplaceExistsCopy() |
|
166 | } |
||
167 |
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.