Merge pull request #35828 from nextcloud/fix/fix-oauth2-test-dynamic-property

Fix PHP error on PHP >= 8.2 about dynamic property use in tests
pull/35545/head
Vincent Petry 2022-12-20 08:45:12 +07:00 committed by GitHub
commit fcf5789916
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

@ -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);