Skip to content

Commit e653a5c

Browse files
bump phpunit and fix deprecations
1 parent 0032301 commit e653a5c

File tree

6 files changed

+73
-79
lines changed

6 files changed

+73
-79
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"psr/http-server-middleware": "^1.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^9.6.21",
19+
"phpunit/phpunit": "^11.5",
2020
"laminas/laminas-diactoros": "^3.5",
2121
"phpstan/phpstan": "^1.12",
2222
"phpstan/phpstan-phpunit": "^1.3.15",

phpunit.xml.dist

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4-
colors="true"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
displayDetailsOnPhpunitDeprecations="true"
6+
failOnPhpunitDeprecation="true"
7+
failOnRisky="true"
8+
failOnWarning="true"
59
stopOnError="true"
6-
stopOnFailure="true"
7-
stopOnIncomplete="false"
8-
stopOnSkipped="false"
9-
bootstrap="tests/Bootstrap.php"
10-
>
11-
<coverage includeUncoveredFiles="true">
12-
<include>
13-
<directory suffix=".php">src</directory>
14-
</include>
15-
</coverage>
10+
stopOnFailure="true">
1611
<testsuites>
1712
<testsuite name="Tests">
1813
<directory>./tests/</directory>
1914
</testsuite>
2015
</testsuites>
16+
17+
<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
18+
<include>
19+
<directory>src</directory>
20+
</include>
21+
</source>
2122
</phpunit>

src/AuthorizationValidators/BearerTokenValidator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private function initJwtConfiguration(): void
7474
throw new RuntimeException('Public key is empty');
7575
}
7676

77+
// TODO: next major release: replace deprecated method
7778
$this->jwtConfiguration->setValidationConstraints(
7879
new LooseValidAt($clock, $this->jwtValidAtDateLeeway),
7980
new SignedWith(

tests/Bootstrap.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/Exception/OAuthServerExceptionTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
namespace LeagueTests\Exception;
66

7+
use DateInterval;
78
use Exception;
89
use Laminas\Diactoros\Response;
910
use Laminas\Diactoros\ServerRequest;
1011
use League\OAuth2\Server\Exception\OAuthServerException;
1112
use League\OAuth2\Server\Grant\AbstractGrant;
1213
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
14+
use League\OAuth2\Server\ResponseTypes\ResponseTypeInterface;
1315
use PHPUnit\Framework\TestCase;
1416
use Psr\Http\Message\ServerRequestInterface;
1517
use ReflectionClass;
@@ -93,7 +95,17 @@ private function issueInvalidClientException(ServerRequestInterface $serverReque
9395
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
9496
$clientRepositoryMock->method('validateClient')->willReturn(false);
9597

96-
$grantMock = $this->getMockForAbstractClass(AbstractGrant::class);
98+
$grantMock = new class () extends AbstractGrant {
99+
public function getIdentifier(): string
100+
{
101+
return 'foo';
102+
}
103+
104+
public function respondToAccessTokenRequest(ServerRequestInterface $request, ResponseTypeInterface $responseType, DateInterval $accessTokenTTL): ResponseTypeInterface
105+
{
106+
return $responseType;
107+
}
108+
};
97109
$grantMock->setClientRepository($clientRepositoryMock);
98110

99111
$abstractGrantReflection = new ReflectionClass($grantMock);

0 commit comments

Comments
 (0)