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 Bunq\Tests\Service; |
||
4 | |||
5 | use Bunq\Certificate\CertificateType; |
||
6 | use Bunq\Certificate\DefaultCertificate; |
||
7 | use Bunq\Certificate\Storage\CertificateStorage; |
||
8 | use Bunq\Service\InstallationService; |
||
9 | use Bunq\Service\DefaultTokenService; |
||
10 | use Bunq\Token\DefaultToken; |
||
11 | use Bunq\Token\Storage\TokenNotFoundException; |
||
12 | use Bunq\Token\Storage\TokenStorage; |
||
13 | use Bunq\Token\TokenType; |
||
14 | use PHPUnit\Framework\TestCase; |
||
15 | use Prophecy\Argument; |
||
16 | use Prophecy\Prophecy\ObjectProphecy; |
||
17 | |||
18 | final class TokenServiceTest extends TestCase |
||
19 | { |
||
20 | /** |
||
21 | * @var InstallationService|ObjectProphecy |
||
22 | */ |
||
23 | private $installationService; |
||
24 | |||
25 | /** |
||
26 | * @var TokenStorage|ObjectProphecy |
||
27 | */ |
||
28 | private $tokenStorage; |
||
29 | |||
30 | /** |
||
31 | * @var CertificateStorage|ObjectProphecy |
||
32 | */ |
||
33 | private $certificateStorage; |
||
34 | |||
35 | /** |
||
36 | * @var DefaultTokenService |
||
37 | */ |
||
38 | private $service; |
||
39 | |||
40 | public function setUp() |
||
41 | { |
||
42 | $this->installationService = $this->prophesize(InstallationService::class); |
||
43 | $this->tokenStorage = $this->prophesize(TokenStorage::class); |
||
44 | $this->certificateStorage = $this->prophesize(CertificateStorage::class); |
||
45 | |||
46 | $this->service = new DefaultTokenService( |
||
47 | $this->installationService->reveal(), |
||
48 | $this->tokenStorage->reveal(), |
||
49 | $this->certificateStorage->reveal() |
||
50 | ); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @test |
||
55 | */ |
||
56 | public function itReturnsASessionToken() |
||
57 | { |
||
58 | $token = new DefaultToken('someToken'); |
||
59 | $this->tokenStorage->load(TokenType::SESSION_TOKEN())->willReturn($token); |
||
0 ignored issues
–
show
|
|||
60 | $this->installationService->createSession(Argument::any())->shouldNotBeCalled(); |
||
0 ignored issues
–
show
The method
createSession does only exist in Bunq\Service\InstallationService , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() \Prophecy\Argument::any() is of type object<Prophecy\Argument\Token\AnyValueToken> , but the function expects a object<Bunq\Token\Token> .
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);
![]() |
|||
61 | |||
62 | $result = $this->service->sessionToken(); |
||
63 | |||
64 | $this->assertEquals($token, $result); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @test |
||
69 | */ |
||
70 | public function itCreatesANewSessionTokenWhenItDoesNotExist() |
||
71 | { |
||
72 | $this->tokenStorage->load(TokenType::SESSION_TOKEN())->willThrow( |
||
0 ignored issues
–
show
The method
load does only exist in Bunq\Token\Storage\TokenStorage , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
73 | new TokenNotFoundException(TokenType::SESSION_TOKEN(), 'path') |
||
74 | ); |
||
75 | |||
76 | $installationToken = new DefaultToken('installation_token'); |
||
77 | $this->tokenStorage->load(TokenType::INSTALLATION_TOKEN())->willReturn($installationToken); |
||
78 | |||
79 | $this->installationService->install()->shouldNotBeCalled(); |
||
0 ignored issues
–
show
The method
install does only exist in Bunq\Service\InstallationService , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
80 | $this->installationService->createSession($installationToken)->willReturn('a-long-new-session-token'); |
||
0 ignored issues
–
show
The method
createSession does only exist in Bunq\Service\InstallationService , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
81 | $this->installationService->registerDevice(Argument::any())->shouldNotBeCalled(); |
||
0 ignored issues
–
show
The method
registerDevice does only exist in Bunq\Service\InstallationService , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() \Prophecy\Argument::any() is of type object<Prophecy\Argument\Token\AnyValueToken> , but the function expects a object<Bunq\Token\Token> .
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);
![]() |
|||
82 | |||
83 | $sessionToken = DefaultToken::fromString('a-long-new-session-token'); |
||
84 | |||
85 | $this->tokenStorage->save($sessionToken, TokenType::SESSION_TOKEN())->shouldBeCalled(); |
||
0 ignored issues
–
show
The method
save does only exist in Bunq\Token\Storage\TokenStorage , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
86 | |||
87 | $this->assertEquals($sessionToken, $this->service->sessionToken()); |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @test |
||
92 | */ |
||
93 | public function itCreatesANewSessionTokenAndInstallationTokenWithThePublicKey() |
||
94 | { |
||
95 | $this->tokenStorage->load(TokenType::SESSION_TOKEN())->willThrow( |
||
0 ignored issues
–
show
The method
load does only exist in Bunq\Token\Storage\TokenStorage , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
96 | new TokenNotFoundException(TokenType::SESSION_TOKEN(), 'path') |
||
97 | ); |
||
98 | $this->tokenStorage->load(TokenType::INSTALLATION_TOKEN())->willThrow( |
||
99 | new TokenNotFoundException(TokenType::INSTALLATION_TOKEN(), 'path') |
||
100 | ); |
||
101 | |||
102 | $this->installationService->install()->willReturn( |
||
0 ignored issues
–
show
The method
install does only exist in Bunq\Service\InstallationService , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
103 | [ |
||
104 | 'token' => 'a-long-new-installation-token', |
||
105 | 'public_key' => '-----BEGIN PUBLIC KEY-----KEY-----END PUBLIC KEY-----' |
||
106 | ] |
||
107 | ); |
||
108 | |||
109 | $installationToken = DefaultToken::fromString('a-long-new-installation-token'); |
||
110 | $this->tokenStorage->save($installationToken, TokenType::INSTALLATION_TOKEN())->shouldBeCalled(); |
||
0 ignored issues
–
show
The method
save does only exist in Bunq\Token\Storage\TokenStorage , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
111 | |||
112 | $certificate = DefaultCertificate::fromString('-----BEGIN PUBLIC KEY-----KEY-----END PUBLIC KEY-----'); |
||
113 | $this->certificateStorage->save($certificate, CertificateType::BUNQ_SERVER_KEY())->shouldBeCalled(); |
||
0 ignored issues
–
show
The method
save does only exist in Bunq\Certificate\Storage\CertificateStorage , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
114 | |||
115 | $this->installationService->registerDevice($installationToken)->shouldBeCalled(); |
||
0 ignored issues
–
show
The method
registerDevice does only exist in Bunq\Service\InstallationService , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
116 | |||
117 | $this->installationService->createSession($installationToken)->willReturn('a-long-new-session-token'); |
||
0 ignored issues
–
show
The method
createSession does only exist in Bunq\Service\InstallationService , but not in Prophecy\Prophecy\ObjectProphecy .
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
![]() |
|||
118 | |||
119 | $sessionToken = DefaultToken::fromString('a-long-new-session-token'); |
||
120 | |||
121 | $this->tokenStorage->save($sessionToken, TokenType::SESSION_TOKEN())->shouldBeCalled(); |
||
122 | |||
123 | $this->assertEquals($sessionToken, $this->service->sessionToken()); |
||
124 | } |
||
125 | } |
||
126 | |||
127 |
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: