This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace DoctrineORMModuleTest\Yuml; |
||
4 | |||
5 | use DoctrineORMModule\Yuml\YumlController; |
||
6 | use PHPUnit\Framework\TestCase; |
||
7 | |||
8 | /** |
||
9 | * Tests for Yuml redirector controller |
||
10 | * |
||
11 | * @license MIT |
||
12 | * @link http://www.doctrine-project.org/ |
||
13 | * @author Marco Pivetta <[email protected]> |
||
14 | */ |
||
15 | class YumlControllerTest extends TestCase |
||
16 | { |
||
17 | /** |
||
18 | * @var YumlController |
||
19 | */ |
||
20 | protected $controller; |
||
21 | |||
22 | /** |
||
23 | * @var \Laminas\Http\Client|\PHPUnit_Framework_MockObject_MockObject |
||
24 | */ |
||
25 | protected $httpClient; |
||
26 | |||
27 | /** |
||
28 | * @var \Laminas\Mvc\Controller\PluginManager|\PHPUnit_Framework_MockObject_MockObject |
||
29 | */ |
||
30 | protected $pluginManager; |
||
31 | |||
32 | /** |
||
33 | * {@inheritDoc} |
||
34 | * |
||
35 | * @covers \DoctrineORMModule\Yuml\YumlController::__construct |
||
36 | */ |
||
37 | public function setUp() : void |
||
38 | { |
||
39 | $this->httpClient = $this->createMock(\Laminas\Http\Client::class); |
||
0 ignored issues
–
show
|
|||
40 | $this->controller = new YumlController($this->httpClient); |
||
0 ignored issues
–
show
$this->httpClient is of type null , but the function expects a object<Laminas\Http\Client> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
41 | $this->pluginManager = $this->getMockBuilder(\Laminas\Mvc\Controller\PluginManager::class) |
||
0 ignored issues
–
show
|
|||
42 | ->disableOriginalConstructor() |
||
43 | ->getMock(); |
||
44 | $this->controller->setPluginManager($this->pluginManager); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @covers \DoctrineORMModule\Yuml\YumlController::indexAction |
||
49 | */ |
||
50 | public function testIndexActionWillRedirectToYuml() |
||
51 | { |
||
52 | $response = $this->createMock(\Laminas\Http\Response::class); |
||
0 ignored issues
–
show
Are you sure the assignment to
$response is correct as $this->createMock(\Laminas\Http\Response::class) (which targets PHPUnit\Framework\TestCase::createMock() ) seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
53 | $controllerResponse = $this->createMock(\Laminas\Http\Response::class); |
||
0 ignored issues
–
show
Are you sure the assignment to
$controllerResponse is correct as $this->createMock(\Laminas\Http\Response::class) (which targets PHPUnit\Framework\TestCase::createMock() ) seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
54 | $redirect = $this->createMock(\Laminas\Mvc\Controller\Plugin\Redirect::class); |
||
0 ignored issues
–
show
Are you sure the assignment to
$redirect is correct as $this->createMock(\Lamin...Plugin\Redirect::class) (which targets PHPUnit\Framework\TestCase::createMock() ) seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
55 | $this->httpClient->expects($this->any())->method('send')->will($this->returnValue($response)); |
||
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Laminas\Http\Client> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() The method
any() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() The method
returnValue() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
56 | $response->expects($this->any())->method('isSuccess')->will($this->returnValue(true)); |
||
0 ignored issues
–
show
The method
any() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() The method
returnValue() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
57 | $response->expects($this->any())->method('getBody')->will($this->returnValue('short-url')); |
||
0 ignored issues
–
show
The method
any() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() The method
returnValue() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
58 | $this |
||
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Laminas\Mvc\Controller\PluginManager> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
59 | ->pluginManager |
||
60 | ->expects($this->any()) |
||
0 ignored issues
–
show
The method
any() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
61 | ->method('get')->with('redirect') |
||
62 | ->will($this->returnValue($redirect)); |
||
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
63 | $redirect |
||
0 ignored issues
–
show
|
|||
64 | ->expects($this->any()) |
||
0 ignored issues
–
show
The method
any() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
65 | ->method('toUrl') |
||
66 | ->with('https://yuml.me/short-url') |
||
67 | ->will($this->returnValue($controllerResponse)); |
||
0 ignored issues
–
show
The method
returnValue() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
68 | |||
69 | $this->assertSame($controllerResponse, $this->controller->indexAction()); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @covers \DoctrineORMModule\Yuml\YumlController::indexAction |
||
74 | */ |
||
75 | public function testIndexActionWillFailOnMalformedResponse() |
||
76 | { |
||
77 | $response = $this->createMock(\Laminas\Http\Response::class); |
||
0 ignored issues
–
show
Are you sure the assignment to
$response is correct as $this->createMock(\Laminas\Http\Response::class) (which targets PHPUnit\Framework\TestCase::createMock() ) seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
78 | $this->httpClient->expects($this->any())->method('send')->will($this->returnValue($response)); |
||
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Laminas\Http\Client> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() The method
any() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() The method
returnValue() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
79 | $response->expects($this->any())->method('isSuccess')->will($this->returnValue(false)); |
||
0 ignored issues
–
show
The method
any() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() The method
returnValue() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
80 | |||
81 | $this->expectException(\UnexpectedValueException::class); |
||
0 ignored issues
–
show
The method
expectException() does not seem to exist on object<DoctrineORMModule...uml\YumlControllerTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
82 | $this->controller->indexAction(); |
||
83 | } |
||
84 | } |
||
85 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.