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; |
||
13 | |||
14 | use phpDocumentor\Configuration; |
||
15 | use phpDocumentor\Transformer\Configuration\ExternalClassDocumentation; |
||
16 | |||
17 | class ExternalRouterTest extends \Mockery\Adapter\Phpunit\MockeryTestCase |
||
18 | { |
||
19 | /** |
||
20 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::__construct |
||
21 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::configure |
||
22 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::match |
||
23 | */ |
||
24 | public function testIfNoUrlIsGeneratedWhenThereIsNoDefinition() |
||
25 | { |
||
26 | $this->markTestSkipped('External router needs to be redefined, config is missing'); |
||
27 | // Arrange |
||
28 | $router = new ExternalRouter(); |
||
29 | |||
30 | // Act |
||
31 | $result = $router->match('My_Space_With_Suffix'); |
||
32 | |||
33 | // Assert |
||
34 | $this->assertNull($result); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::__construct |
||
39 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::configure |
||
40 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::match |
||
41 | */ |
||
42 | public function testIfSingleDefinitionGeneratesAnUrl() |
||
43 | { |
||
44 | $this->markTestSkipped('External router needs to be redefined, config is missing'); |
||
45 | // Arrange |
||
0 ignored issues
–
show
|
|||
46 | // $config->getTransformer()->setExternalClassDocumentation( |
||
47 | // [new ExternalClassDocumentation('My_Space', 'http://abc/{CLASS}.html')] |
||
48 | // ); |
||
49 | |||
50 | $router = new ExternalRouter(); |
||
51 | |||
52 | // Act |
||
53 | $result = $router->match('My_Space_With_Suffix')->generate('My_Space_With_Suffix'); |
||
54 | |||
55 | // Assert |
||
56 | $this->assertSame('http://abc/My_Space_With_Suffix.html', $result); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::__construct |
||
61 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::configure |
||
62 | * @covers phpDocumentor\Transformer\Router\ExternalRouter::match |
||
63 | */ |
||
64 | public function testIfMultipleDefinitionsGenerateAnUrl() |
||
65 | { |
||
66 | $this->markTestSkipped('External router needs to be redefined, config is missing'); |
||
67 | // Arrange |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
68 | // $config = new Configuration(); |
||
69 | // $config->getTransformer()->setExternalClassDocumentation( |
||
70 | // [ |
||
71 | // new ExternalClassDocumentation('My_Zen_Space', 'http://abc/zen/{CLASS}.html'), |
||
72 | // new ExternalClassDocumentation('My_Space', 'http://abc/{CLASS}.html'), |
||
73 | // ] |
||
74 | // ); |
||
75 | $router = new ExternalRouter(); |
||
76 | |||
77 | // Act |
||
78 | $result = $router->match('My_Space_With_Suffix')->generate('My_Space_With_Suffix'); |
||
79 | |||
80 | // Assert |
||
81 | $this->assertSame('http://abc/My_Space_With_Suffix.html', $result); |
||
82 | } |
||
83 | } |
||
84 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.