Skip to content

Commit e83ca9a

Browse files
author
Simon
committed
fix phpunit
1 parent 5c7499d commit e83ca9a

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

tests/LegacyEndpointPayconiqCallbackSignatureVerifierTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ protected function tearDown(): void
6060
public function testIsValid(): void
6161
{
6262
$url = 'https://ext.payconiq.com/certificates';
63+
$cacheKey = 'payconiq_certificates_' . md5($url);
6364
$jwkSetJson = json_encode(['keys' => [['kty' => 'string']]]);
6465
$this->cache
6566
->expects($this->once())
6667
->method('get')
67-
->with($url, function (ItemInterface $item) use ($url) {
68+
->with($cacheKey, function (ItemInterface $item) use ($url) {
6869
})
6970
->willReturn($jwkSetJson);
7071

@@ -79,11 +80,12 @@ public function testIsValid(): void
7980
public function testIsInvalid(): void
8081
{
8182
$url = 'https://ext.payconiq.com/certificates';
83+
$cacheKey = 'payconiq_certificates_' . md5($url);
8284
$jwkSetJson = json_encode(['keys' => [['kty' => 'string']]]);
8385
$this->cache
8486
->expects($this->once())
8587
->method('get')
86-
->with($url, function (ItemInterface $item) use ($url) {
88+
->with($cacheKey, function (ItemInterface $item) use ($url) {
8789
})
8890
->willReturn($jwkSetJson);
8991

@@ -99,11 +101,12 @@ public function testIsInvalid(): void
99101
public function testLoadAndVerifyJWS(): void
100102
{
101103
$url = 'https://ext.payconiq.com/certificates';
104+
$cacheKey = 'payconiq_certificates_' . md5($url);
102105
$jwkSetJson = json_encode(['keys' => [['kty' => 'string']]]);
103106
$this->cache
104107
->expects($this->once())
105108
->method('get')
106-
->with($url, function (ItemInterface $item) use ($url) {
109+
->with($cacheKey, function (ItemInterface $item) use ($url) {
107110
})
108111
->willReturn($jwkSetJson);
109112

@@ -122,11 +125,12 @@ public function testLoadAndVerifyJWS(): void
122125
public function testLoadAndVerifyJWSItShouldThrow(): void
123126
{
124127
$url = 'https://ext.payconiq.com/certificates';
128+
$cacheKey = 'payconiq_certificates_' . md5($url);
125129
$jwkSetJson = json_encode(['keys' => [['kty' => 'string']]]);
126130
$this->cache
127131
->expects($this->once())
128132
->method('get')
129-
->with($url, function (ItemInterface $item) use ($url) {
133+
->with($cacheKey, function (ItemInterface $item) use ($url) {
130134
})
131135
->willReturn($jwkSetJson);
132136

tests/NewEndpointPayconiqCallbackSignatureVerifierTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ protected function tearDown(): void
6565
public function testIsValid(): void
6666
{
6767
$url = 'https://jwks.preprod.bancontact.net';
68+
$cacheKey = 'payconiq_certificates_' . md5($url);
6869
$jwkSetJson = json_encode(['keys' => [['kty' => 'string']]]);
6970
$this->cache
7071
->expects($this->once())
7172
->method('get')
72-
->with($url, function (ItemInterface $item) use ($url) {
73+
->with($cacheKey, function (ItemInterface $item) use ($url) {
7374
})
7475
->willReturn($jwkSetJson);
7576

@@ -84,11 +85,12 @@ public function testIsValid(): void
8485
public function testIsInvalid(): void
8586
{
8687
$url = 'https://jwks.preprod.bancontact.net';
88+
$cacheKey = 'payconiq_certificates_' . md5($url);
8789
$jwkSetJson = json_encode(['keys' => [['kty' => 'string']]]);
8890
$this->cache
8991
->expects($this->once())
9092
->method('get')
91-
->with($url, function (ItemInterface $item) use ($url) {
93+
->with($cacheKey, function (ItemInterface $item) use ($url) {
9294
})
9395
->willReturn($jwkSetJson);
9496

@@ -104,11 +106,12 @@ public function testIsInvalid(): void
104106
public function testLoadAndVerifyJWS(): void
105107
{
106108
$url = 'https://jwks.preprod.bancontact.net';
109+
$cacheKey = 'payconiq_certificates_' . md5($url);
107110
$jwkSetJson = json_encode(['keys' => [['kty' => 'string']]]);
108111
$this->cache
109112
->expects($this->once())
110113
->method('get')
111-
->with($url, function (ItemInterface $item) use ($url) {
114+
->with($cacheKey, function (ItemInterface $item) use ($url) {
112115
})
113116
->willReturn($jwkSetJson);
114117

@@ -127,11 +130,12 @@ public function testLoadAndVerifyJWS(): void
127130
public function testLoadAndVerifyJWSItShouldThrow(): void
128131
{
129132
$url = 'https://jwks.preprod.bancontact.net';
133+
$cacheKey = 'payconiq_certificates_' . md5($url);
130134
$jwkSetJson = json_encode(['keys' => [['kty' => 'string']]]);
131135
$this->cache
132136
->expects($this->once())
133137
->method('get')
134-
->with($url, function (ItemInterface $item) use ($url) {
138+
->with($cacheKey, function (ItemInterface $item) use ($url) {
135139
})
136140
->willReturn($jwkSetJson);
137141

0 commit comments

Comments
 (0)