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 Loevgaard\DandomainAltapayBundle\Tests\Entity; |
||
4 | |||
5 | use Loevgaard\DandomainAltapayBundle\Entity\Terminal; |
||
6 | use Loevgaard\DandomainAltapayBundle\Entity\TerminalRepository; |
||
7 | use Loevgaard\DandomainAltapayBundle\Synchronizer\TerminalSynchronizer; |
||
8 | use PHPUnit\Framework\TestCase; |
||
9 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
10 | |||
11 | class TerminalRepositoryTest extends TestCase |
||
12 | { |
||
13 | public function testReturnNull() |
||
14 | { |
||
15 | $terminalRepository = $this->getTerminalRepository(); |
||
16 | |||
17 | $terminalRepository |
||
18 | ->method('findOneBy') |
||
19 | ->willReturn(null); |
||
20 | |||
21 | $this->assertSame(null, $terminalRepository->findTerminalBySlug('slug')); |
||
0 ignored issues
–
show
|
|||
22 | } |
||
23 | |||
24 | View Code Duplication | public function testFindTerminalByTitle() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
25 | { |
||
26 | $terminalRepository = $this->getTerminalRepository(); |
||
27 | |||
28 | $obj = new Terminal(); |
||
29 | $terminalRepository |
||
30 | ->method('findOneBy') |
||
31 | ->willReturn($obj); |
||
32 | |||
33 | $this->assertSame($obj, $terminalRepository->findTerminalByTitle('title')); |
||
0 ignored issues
–
show
The method
findTerminalByTitle does only exist in Loevgaard\DandomainAltap...tity\TerminalRepository , but not in PHPUnit_Framework_MockObject_MockObject .
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: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
34 | } |
||
35 | |||
36 | View Code Duplication | public function testFindTerminalByTitleWithFetch() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
37 | { |
||
38 | $terminalRepository = $this->getTerminalRepository(); |
||
39 | |||
40 | $obj = new Terminal(); |
||
41 | $terminalRepository |
||
42 | ->method('findOneBy') |
||
43 | ->will($this->onConsecutiveCalls(null, $obj)); |
||
44 | |||
45 | $this->assertSame($obj, $terminalRepository->findTerminalByTitle('title', true)); |
||
0 ignored issues
–
show
The method
findTerminalByTitle does only exist in Loevgaard\DandomainAltap...tity\TerminalRepository , but not in PHPUnit_Framework_MockObject_MockObject .
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: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
46 | } |
||
47 | |||
48 | View Code Duplication | public function testFindTerminalBySlug() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
49 | { |
||
50 | $terminalRepository = $this->getTerminalRepository(); |
||
51 | |||
52 | $obj = new Terminal(); |
||
53 | $terminalRepository |
||
54 | ->method('findOneBy') |
||
55 | ->willReturn($obj); |
||
56 | |||
57 | $this->assertSame($obj, $terminalRepository->findTerminalBySlug('slug')); |
||
0 ignored issues
–
show
The method
findTerminalBySlug does only exist in Loevgaard\DandomainAltap...tity\TerminalRepository , but not in PHPUnit_Framework_MockObject_MockObject .
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: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
58 | } |
||
59 | |||
60 | View Code Duplication | public function testFindTerminalBySlugWithFetch() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
61 | { |
||
62 | $terminalRepository = $this->getTerminalRepository(); |
||
63 | |||
64 | $obj = new Terminal(); |
||
65 | $terminalRepository |
||
66 | ->method('findOneBy') |
||
67 | ->will($this->onConsecutiveCalls(null, $obj)); |
||
68 | |||
69 | $this->assertSame($obj, $terminalRepository->findTerminalBySlug('slug', true)); |
||
0 ignored issues
–
show
The method
findTerminalBySlug does only exist in Loevgaard\DandomainAltap...tity\TerminalRepository , but not in PHPUnit_Framework_MockObject_MockObject .
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: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @return TerminalRepository|\PHPUnit_Framework_MockObject_MockObject |
||
74 | */ |
||
75 | private function getTerminalRepository() |
||
76 | { |
||
77 | /** @var TerminalRepository|\PHPUnit_Framework_MockObject_MockObject $terminalRepository */ |
||
78 | $terminalRepository = $this->getMockBuilder(TerminalRepository::class) |
||
79 | ->disableOriginalConstructor() |
||
80 | ->setMethods(['findOneBy']) |
||
81 | ->getMock(); |
||
82 | |||
83 | $container = $this->getMockBuilder(ContainerInterface::class) |
||
84 | ->disableOriginalConstructor() |
||
85 | ->getMock(); |
||
86 | |||
87 | $terminalSynchronizer = $this->getMockBuilder(TerminalSynchronizer::class) |
||
88 | ->disableOriginalConstructor() |
||
89 | ->getMock(); |
||
90 | |||
91 | $terminalSynchronizer |
||
92 | ->method('syncAll') |
||
93 | ->willReturn(null); |
||
94 | |||
95 | // the only get call we do is a call to retrieve the terminal synchronizer |
||
96 | $container |
||
97 | ->method('get') |
||
98 | ->willReturn($terminalSynchronizer); |
||
99 | |||
100 | $terminalRepository->setContainer($container); |
||
0 ignored issues
–
show
The method
setContainer does only exist in Loevgaard\DandomainAltap...tity\TerminalRepository , but not in PHPUnit_Framework_MockObject_MockObject .
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: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() $container is of type object<PHPUnit\Framework\MockObject\MockObject> , but the function expects a null|object<Symfony\Comp...ion\ContainerInterface> .
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);
![]() |
|||
101 | |||
102 | return $terminalRepository; |
||
103 | } |
||
104 | } |
||
105 |
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: