From 9b26c4a27705ebbf8b6f6842f75af3f2e0608939 Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Mon, 19 Dec 2022 15:58:46 +0100 Subject: Fix PHP error on PHP >= 8.2 about dynamic property use in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/oauth2/tests/Controller/OauthApiControllerTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/oauth2/tests/Controller/OauthApiControllerTest.php b/apps/oauth2/tests/Controller/OauthApiControllerTest.php index 24385e785e5..8977f6a2b66 100644 --- a/apps/oauth2/tests/Controller/OauthApiControllerTest.php +++ b/apps/oauth2/tests/Controller/OauthApiControllerTest.php @@ -45,6 +45,11 @@ use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; use Test\TestCase; +/* We have to use this to add a property to the mocked request and avoid warnings about dynamic properties on PHP>=8.2 */ +abstract class RequestMock implements IRequest { + public array $server = []; +} + class OauthApiControllerTest extends TestCase { /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */ private $request; @@ -68,7 +73,7 @@ class OauthApiControllerTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->request = $this->createMock(IRequest::class); + $this->request = $this->createMock(RequestMock::class); $this->crypto = $this->createMock(ICrypto::class); $this->accessTokenMapper = $this->createMock(AccessTokenMapper::class); $this->clientMapper = $this->createMock(ClientMapper::class); -- cgit v1.2.3