Skip to content

Commit 5339d6a

Browse files
authored
Merge pull request #230 from mrtus/patch-1
Loosen `psr/http-message` version to allow `^2.0`
2 parents 86a4217 + 5250150 commit 5339d6a

File tree

4 files changed

+130
-4
lines changed

4 files changed

+130
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"ext-soap": "*",
3131
"moneyphp/money": "^3.0 || ^4.0",
3232
"myclabs/php-enum": "^1.5",
33-
"psr/http-message": "^1.0",
33+
"psr/http-message": "^1.0 || ^2.0",
3434
"psr/log": "^1.0 || ^2.0 || ^3.0",
3535
"webmozart/assert": "^1.2"
3636
},

phpstan.neon

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,46 @@
11
parameters:
22
ignoreErrors:
3+
-
4+
message: "#^Method Dummy\\\\StringStream\\:\\:eof\\(\\) should return bool but return statement is missing\\.$#"
5+
count: 1
6+
path: tests/Dummy/StringStream.php
7+
8+
-
9+
message: "#^Method Dummy\\\\StringStream\\:\\:getContents\\(\\) should return string but return statement is missing\\.$#"
10+
count: 1
11+
path: tests/Dummy/StringStream.php
12+
13+
-
14+
message: "#^Method Dummy\\\\StringStream\\:\\:getSize\\(\\) should return int\\|null but return statement is missing\\.$#"
15+
count: 1
16+
path: tests/Dummy/StringStream.php
17+
18+
-
19+
message: "#^Method Dummy\\\\StringStream\\:\\:isReadable\\(\\) should return bool but return statement is missing\\.$#"
20+
count: 1
21+
path: tests/Dummy/StringStream.php
22+
23+
-
24+
message: "#^Method Dummy\\\\StringStream\\:\\:isSeekable\\(\\) should return bool but return statement is missing\\.$#"
25+
count: 1
26+
path: tests/Dummy/StringStream.php
27+
28+
-
29+
message: "#^Method Dummy\\\\StringStream\\:\\:isWritable\\(\\) should return bool but return statement is missing\\.$#"
30+
count: 1
31+
path: tests/Dummy/StringStream.php
32+
33+
-
34+
message: "#^Method Dummy\\\\StringStream\\:\\:read\\(\\) should return string but return statement is missing\\.$#"
35+
count: 1
36+
path: tests/Dummy/StringStream.php
37+
38+
-
39+
message: "#^Method Dummy\\\\StringStream\\:\\:tell\\(\\) should return int but return statement is missing\\.$#"
40+
count: 1
41+
path: tests/Dummy/StringStream.php
42+
43+
-
44+
message: "#^Method Dummy\\\\StringStream\\:\\:write\\(\\) should return int but return statement is missing\\.$#"
45+
count: 1
46+
path: tests/Dummy/StringStream.php

tests/Dummy/StringStream.php

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Dummy;
6+
7+
use Psr\Http\Message\StreamInterface;
8+
9+
final class StringStream implements StreamInterface
10+
{
11+
/**
12+
* @var string
13+
*/
14+
private $value;
15+
16+
public function __construct(string $value)
17+
{
18+
$this->value = $value;
19+
}
20+
21+
public function __toString(): string
22+
{
23+
return $this->value;
24+
}
25+
26+
public function close(): void
27+
{
28+
}
29+
30+
public function detach()
31+
{
32+
}
33+
34+
public function getSize(): ?int
35+
{
36+
}
37+
38+
public function tell(): int
39+
{
40+
}
41+
42+
public function eof(): bool
43+
{
44+
}
45+
46+
public function isSeekable(): bool
47+
{
48+
}
49+
50+
public function seek(int $offset, int $whence = SEEK_SET): void
51+
{
52+
}
53+
54+
public function rewind(): void
55+
{
56+
}
57+
58+
public function isWritable(): bool
59+
{
60+
}
61+
62+
public function write(string $string): int
63+
{
64+
}
65+
66+
public function isReadable(): bool
67+
{
68+
}
69+
70+
public function read(int $length): string
71+
{
72+
}
73+
74+
public function getContents(): string
75+
{
76+
}
77+
78+
public function getMetadata(?string $key = null)
79+
{
80+
}
81+
}

tests/UnitTests/Secure/Provider/OAuthProviderTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PhpTwinfield\Secure\Provider;
44

5+
use Dummy\StringStream;
56
use GuzzleHttp\ClientInterface;
67
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
78
use League\OAuth2\Client\Token\AccessToken;
@@ -77,7 +78,7 @@ public function testGetAccessToken()
7778
$response = $this->createMock(ResponseInterface::class);
7879
$response->expects($this->any())
7980
->method("getBody")
80-
->willReturn('{"access_token":"mock_access_token", "token_type":"bearer"}');
81+
->willReturn(new StringStream('{"access_token":"mock_access_token", "token_type":"bearer"}'));
8182
$response->expects($this->any())
8283
->method("getHeader")
8384
->willReturn(['content-type' => 'json']);
@@ -102,7 +103,7 @@ public function testExceptionThrownWhenErrorObjectReceived()
102103
$response = $this->createMock(ResponseInterface::class);
103104
$response->expects($this->any())
104105
->method("getBody")
105-
->willReturn('{"error":{"type":"request","message":"someErrorMessage"}}');
106+
->willReturn(new StringStream('{"error":{"type":"request","message":"someErrorMessage"}}'));
106107
$response->expects($this->any())
107108
->method("getHeader")
108109
->willReturn(['content-type' => 'json']);
@@ -125,7 +126,7 @@ public function testGetResourceOwnerDetails()
125126
$response = $this->createMock(ResponseInterface::class);
126127
$response->expects($this->any())
127128
->method("getBody")
128-
->willReturn('{"sub": "someId", "twf.organisationId": "someOrganisationId"}');
129+
->willReturn(new StringStream('{"sub": "someId", "twf.organisationId": "someOrganisationId"}'));
129130
$response->expects($this->any())
130131
->method("getHeader")
131132
->willReturn(['content-type' => 'json']);

0 commit comments

Comments
 (0)