These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * phpDocumentor |
||
4 | * |
||
5 | * PHP Version 5.3 |
||
6 | * |
||
7 | * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) |
||
8 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||
9 | * @link http://phpdoc.org |
||
10 | */ |
||
11 | |||
12 | namespace phpDocumentor\Transformer\Router\UrlGenerator\Standard; |
||
13 | |||
14 | use Mockery as m; |
||
15 | |||
16 | /** |
||
17 | * Test for the MethodDescriptor URL Generator with the Standard Router |
||
18 | */ |
||
19 | class MethodDescriptorTest extends \Mockery\Adapter\Phpunit\MockeryTestCase |
||
20 | { |
||
21 | /** |
||
22 | * @covers phpDocumentor\Transformer\Router\UrlGenerator\Standard\MethodDescriptor::__invoke |
||
23 | * @covers phpDocumentor\Transformer\Router\UrlGenerator\Standard\QualifiedNameToUrlConverter::fromClass |
||
24 | */ |
||
25 | public function testGenerateUrlForMethodDescriptor() |
||
26 | { |
||
27 | // Arrange |
||
28 | $fixture = new MethodDescriptor(); |
||
29 | $methodDescriptorMock = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); |
||
30 | $methodDescriptorMock |
||
0 ignored issues
–
show
|
|||
31 | ->shouldReceive('getParent->getFullyQualifiedStructuralElementName') |
||
32 | ->andReturn('My\\Space\\Class'); |
||
33 | $methodDescriptorMock->shouldReceive('getName')->andReturn('myMethod'); |
||
34 | |||
35 | // Act |
||
36 | $result = $fixture($methodDescriptorMock); |
||
37 | |||
38 | // Assert |
||
39 | $this->assertSame('/classes/My.Space.Class.html#method_myMethod', $result); |
||
40 | } |
||
41 | } |
||
42 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: