From 0a877e40f5ee5b9eed2eb04a929f1edaeb7c7935 Mon Sep 17 00:00:00 2001 From: George Bateman Date: Wed, 7 Oct 2020 13:47:54 +0100 Subject: [PATCH] Make tests compatible with PHPUnit 8 (#664) --- Tests/Command/CleanCommandTest.php | 10 +-- Tests/Command/CreateClientCommandTest.php | 4 +- Tests/Controller/AuthorizeControllerTest.php | 50 +++++++-------- .../GrantExtensionsCompilerPassTest.php | 8 +-- .../Compiler/RequestStackCompilerPassTest.php | 8 +-- .../DependencyInjection/ConfigurationTest.php | 16 ++--- .../FOSOAuthServerExtensionTest.php | 24 +++---- .../Security/Factory/OAuthFactoryTest.php | 10 +-- Tests/Document/AuthCodeManagerTest.php | 18 +++--- Tests/Document/ClientManagerTest.php | 16 ++--- Tests/Document/TokenManagerTest.php | 16 ++--- Tests/Entity/AuthCodeManagerTest.php | 16 ++--- Tests/Entity/ClientManagerTest.php | 16 ++--- Tests/Entity/TokenManagerTest.php | 20 +++--- Tests/FOSOAuthServerBundleTest.php | 6 +- .../Form/Handler/AuthorizeFormHandlerTest.php | 32 +++++----- Tests/Form/Type/AuthorizeFormTypeTest.php | 10 +-- Tests/Functional/BootTest.php | 2 +- Tests/Model/TokenTest.php | 6 +- Tests/Propel/AuthCodeManagerTest.php | 22 +++---- Tests/Propel/AuthCodeTest.php | 6 +- Tests/Propel/ClientManagerTest.php | 22 +++---- Tests/Propel/ClientTest.php | 6 +- Tests/Propel/PropelTestCase.php | 2 +- Tests/Propel/TokenManagerTest.php | 22 +++---- Tests/Propel/TokenTest.php | 6 +- .../Provider/OAuthProviderTest.php | 18 +++--- .../Authentification/Token/OAuthTokenTest.php | 8 +-- Tests/Security/Firewall/OAuthListenerTest.php | 6 +- Tests/Storage/OAuthStorageTest.php | 64 +++++++++---------- Tests/Util/RandomTest.php | 4 +- 31 files changed, 237 insertions(+), 237 deletions(-) diff --git a/Tests/Command/CleanCommandTest.php b/Tests/Command/CleanCommandTest.php index 2db156c8..214495df 100644 --- a/Tests/Command/CleanCommandTest.php +++ b/Tests/Command/CleanCommandTest.php @@ -27,17 +27,17 @@ class CleanCommandTest extends \PHPUnit\Framework\TestCase private $command; /** - * @var \PHPUnit_Framework_MockObject_MockObject|TokenManagerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|TokenManagerInterface */ private $accessTokenManager; /** - * @var \PHPUnit_Framework_MockObject_MockObject|TokenManagerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|TokenManagerInterface */ private $refreshTokenManager; /** - * @var \PHPUnit_Framework_MockObject_MockObject|AuthCodeManagerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|AuthCodeManagerInterface */ private $authCodeManager; @@ -64,7 +64,7 @@ protected function setUp(): void /** * Delete expired tokens for provided classes. */ - public function testItShouldRemoveExpiredToken() + public function testItShouldRemoveExpiredToken(): void { $expiredAccessTokens = 5; $this->accessTokenManager @@ -100,7 +100,7 @@ public function testItShouldRemoveExpiredToken() /** * Skip classes for deleting expired tokens that do not implement AuthCodeManagerInterface or TokenManagerInterface. */ - public function testItShouldNotRemoveExpiredTokensForOtherClasses() + public function testItShouldNotRemoveExpiredTokensForOtherClasses(): void { $this->markTestIncomplete('Needs a better way of testing this'); diff --git a/Tests/Command/CreateClientCommandTest.php b/Tests/Command/CreateClientCommandTest.php index 9cc738ef..124e09f0 100644 --- a/Tests/Command/CreateClientCommandTest.php +++ b/Tests/Command/CreateClientCommandTest.php @@ -27,7 +27,7 @@ class CreateClientCommandTest extends TestCase private $command; /** - * @var \PHPUnit_Framework_MockObject_MockObject|ClientManagerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|ClientManagerInterface */ private $clientManager; @@ -53,7 +53,7 @@ protected function setUp(): void * * @param string $client a fully qualified class name */ - public function testItShouldCreateClient($client) + public function testItShouldCreateClient($client): void { $this ->clientManager diff --git a/Tests/Controller/AuthorizeControllerTest.php b/Tests/Controller/AuthorizeControllerTest.php index 37b0b898..04d2319a 100644 --- a/Tests/Controller/AuthorizeControllerTest.php +++ b/Tests/Controller/AuthorizeControllerTest.php @@ -38,52 +38,52 @@ class AuthorizeControllerTest extends \PHPUnit\Framework\TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|RequestStack + * @var \PHPUnit\Framework\MockObject\MockObject|RequestStack */ protected $requestStack; /** - * @var \PHPUnit_Framework_MockObject_MockObject|SessionInterface + * @var \PHPUnit\Framework\MockObject\MockObject|SessionInterface */ protected $session; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Form + * @var \PHPUnit\Framework\MockObject\MockObject|Form */ protected $form; /** - * @var \PHPUnit_Framework_MockObject_MockObject|AuthorizeFormHandler + * @var \PHPUnit\Framework\MockObject\MockObject|AuthorizeFormHandler */ protected $authorizeFormHandler; /** - * @var \PHPUnit_Framework_MockObject_MockObject|OAuth2 + * @var \PHPUnit\Framework\MockObject\MockObject|OAuth2 */ protected $oAuth2Server; /** - * @var \PHPUnit_Framework_MockObject_MockObject|TokenStorageInterface + * @var \PHPUnit\Framework\MockObject\MockObject|TokenStorageInterface */ protected $tokenStorage; /** - * @var \PHPUnit_Framework_MockObject_MockObject|TwigEnvironment + * @var \PHPUnit\Framework\MockObject\MockObject|TwigEnvironment */ protected $twig; /** - * @var \PHPUnit_Framework_MockObject_MockObject|UrlGeneratorInterface + * @var \PHPUnit\Framework\MockObject\MockObject|UrlGeneratorInterface */ protected $router; /** - * @var \PHPUnit_Framework_MockObject_MockObject|ClientManagerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|ClientManagerInterface */ protected $clientManager; /** - * @var \PHPUnit_Framework_MockObject_MockObject|EventDispatcherInterface + * @var \PHPUnit\Framework\MockObject\MockObject|EventDispatcherInterface */ protected $eventDispatcher; @@ -93,46 +93,46 @@ class AuthorizeControllerTest extends \PHPUnit\Framework\TestCase protected $instance; /** - * @var \PHPUnit_Framework_MockObject_MockObject|Request + * @var \PHPUnit\Framework\MockObject\MockObject|Request */ protected $request; /** - * @var \PHPUnit_Framework_MockObject_MockObject|ParameterBag + * @var \PHPUnit\Framework\MockObject\MockObject|ParameterBag */ protected $requestQuery; /** - * @var \PHPUnit_Framework_MockObject_MockObject|ParameterBag + * @var \PHPUnit\Framework\MockObject\MockObject|ParameterBag */ protected $requestRequest; /** - * @var \PHPUnit_Framework_MockObject_MockObject|UserInterface + * @var \PHPUnit\Framework\MockObject\MockObject|UserInterface */ protected $user; /** - * @var \PHPUnit_Framework_MockObject_MockObject|ClientInterface + * @var \PHPUnit\Framework\MockObject\MockObject|ClientInterface */ protected $client; /** - * @var \PHPUnit_Framework_MockObject_MockObject|PreAuthorizationEvent + * @var \PHPUnit\Framework\MockObject\MockObject|PreAuthorizationEvent */ protected $preAuthorizationEvent; /** - * @var \PHPUnit_Framework_MockObject_MockObject|PostAuthorizationEvent + * @var \PHPUnit\Framework\MockObject\MockObject|PostAuthorizationEvent */ protected $postAuthorizationEvent; /** - * @var \PHPUnit_Framework_MockObject_MockObject|FormView + * @var \PHPUnit\Framework\MockObject\MockObject|FormView */ protected $formView; - public function setUp() + public function setUp(): void { $this->requestStack = $this->getMockBuilder(RequestStack::class) ->disableOriginalConstructor() @@ -188,7 +188,7 @@ public function setUp() $this->session ); - /** @var \PHPUnit_Framework_MockObject_MockObject&Request $request */ + /** @var \PHPUnit\Framework\MockObject\MockObject&Request $request */ $request = $this->getMockBuilder(Request::class) ->disableOriginalConstructor() ->getMock() @@ -228,7 +228,7 @@ public function setUp() parent::setUp(); } - public function testAuthorizeActionWillThrowAccessDeniedException() + public function testAuthorizeActionWillThrowAccessDeniedException(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() @@ -253,7 +253,7 @@ public function testAuthorizeActionWillThrowAccessDeniedException() $this->instance->authorizeAction($this->request); } - public function testAuthorizeActionWillRenderTemplate() + public function testAuthorizeActionWillRenderTemplate(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() @@ -325,7 +325,7 @@ public function testAuthorizeActionWillRenderTemplate() $this->assertSame($responseBody, $this->instance->authorizeAction($this->request)->getContent()); } - public function testAuthorizeActionWillFinishClientAuthorization() + public function testAuthorizeActionWillFinishClientAuthorization(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() @@ -394,7 +394,7 @@ public function testAuthorizeActionWillFinishClientAuthorization() $this->assertSame($response, $this->instance->authorizeAction($this->request)); } - public function testAuthorizeActionWillEnsureLogout() + public function testAuthorizeActionWillEnsureLogout(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() @@ -480,7 +480,7 @@ public function testAuthorizeActionWillEnsureLogout() $this->assertSame($responseBody, $this->instance->authorizeAction($this->request)->getContent()); } - public function testAuthorizeActionWillProcessAuthorizationForm() + public function testAuthorizeActionWillProcessAuthorizationForm(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() diff --git a/Tests/DependencyInjection/Compiler/GrantExtensionsCompilerPassTest.php b/Tests/DependencyInjection/Compiler/GrantExtensionsCompilerPassTest.php index fee8584b..81ab02d2 100644 --- a/Tests/DependencyInjection/Compiler/GrantExtensionsCompilerPassTest.php +++ b/Tests/DependencyInjection/Compiler/GrantExtensionsCompilerPassTest.php @@ -33,14 +33,14 @@ class GrantExtensionsCompilerPassTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { $this->instance = new GrantExtensionsCompilerPass(); parent::setUp(); } - public function testProcessWillNotDoAnythingIfTheStorageDoesNotImplementOurInterface() + public function testProcessWillNotDoAnythingIfTheStorageDoesNotImplementOurInterface(): void { $container = $this->getMockBuilder(ContainerBuilder::class) ->disableOriginalConstructor() @@ -93,7 +93,7 @@ public function testProcessWillNotDoAnythingIfTheStorageDoesNotImplementOurInter $this->assertNull($this->instance->process($container)); } - public function testProcessWillFailIfUriIsEmpty() + public function testProcessWillFailIfUriIsEmpty(): void { $container = $this->getMockBuilder(ContainerBuilder::class) ->disableOriginalConstructor() @@ -197,7 +197,7 @@ public function testProcessWillFailIfUriIsEmpty() $this->assertNull($this->instance->process($container)); } - public function testProcess() + public function testProcess(): void { $container = $this->getMockBuilder(ContainerBuilder::class) ->disableOriginalConstructor() diff --git a/Tests/DependencyInjection/Compiler/RequestStackCompilerPassTest.php b/Tests/DependencyInjection/Compiler/RequestStackCompilerPassTest.php index b471fcc7..90e8da12 100644 --- a/Tests/DependencyInjection/Compiler/RequestStackCompilerPassTest.php +++ b/Tests/DependencyInjection/Compiler/RequestStackCompilerPassTest.php @@ -31,11 +31,11 @@ class RequestStackCompilerPassTest extends \PHPUnit\Framework\TestCase protected $instance; /** - * @var \PHPUnit_Framework_MockObject_MockObject|ContainerBuilder + * @var \PHPUnit\Framework\MockObject\MockObject|ContainerBuilder */ protected $container; - public function setUp() + public function setUp(): void { $this->container = $this->getMockBuilder(ContainerBuilder::class) ->disableOriginalConstructor() @@ -51,7 +51,7 @@ public function setUp() parent::setUp(); } - public function testProcessWithoutRequestStackDoesNothing() + public function testProcessWithoutRequestStackDoesNothing(): void { $this->container ->expects($this->once()) @@ -63,7 +63,7 @@ public function testProcessWithoutRequestStackDoesNothing() $this->assertNull($this->instance->process($this->container)); } - public function testProcess() + public function testProcess(): void { $this->container ->expects($this->once()) diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 0c072192..52fb2607 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -20,14 +20,14 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase { - public function testShouldImplementConfigurationInterface() + public function testShouldImplementConfigurationInterface(): void { $rc = new \ReflectionClass(Configuration::class); $this->assertTrue($rc->implementsInterface(ConfigurationInterface::class)); } - public function testCouldBeConstructedWithoutAnyArguments() + public function testCouldBeConstructedWithoutAnyArguments(): void { try { new Configuration(); @@ -39,7 +39,7 @@ public function testCouldBeConstructedWithoutAnyArguments() } } - public function testShouldNotMandatoryServiceIfNotCustomDriverIsUsed() + public function testShouldNotMandatoryServiceIfNotCustomDriverIsUsed(): void { $configuration = new Configuration(); $processor = new Processor(); @@ -69,7 +69,7 @@ public function testShouldNotMandatoryServiceIfNotCustomDriverIsUsed() ], $config); } - public function testShouldMakeClientManagerServiceMandatoryIfCustomDriverIsUsed() + public function testShouldMakeClientManagerServiceMandatoryIfCustomDriverIsUsed(): void { $configuration = new Configuration(); $processor = new Processor(); @@ -86,7 +86,7 @@ public function testShouldMakeClientManagerServiceMandatoryIfCustomDriverIsUsed( ]]); } - public function testShouldMakeAccessTokenManagerServiceMandatoryIfCustomDriverIsUsed() + public function testShouldMakeAccessTokenManagerServiceMandatoryIfCustomDriverIsUsed(): void { $configuration = new Configuration(); $processor = new Processor(); @@ -106,7 +106,7 @@ public function testShouldMakeAccessTokenManagerServiceMandatoryIfCustomDriverIs ]]); } - public function testShouldMakeRefreshTokenManagerServiceMandatoryIfCustomDriverIsUsed() + public function testShouldMakeRefreshTokenManagerServiceMandatoryIfCustomDriverIsUsed(): void { $configuration = new Configuration(); $processor = new Processor(); @@ -127,7 +127,7 @@ public function testShouldMakeRefreshTokenManagerServiceMandatoryIfCustomDriverI ]]); } - public function testShouldMakeAuthCodeManagerServiceMandatoryIfCustomDriverIsUsed() + public function testShouldMakeAuthCodeManagerServiceMandatoryIfCustomDriverIsUsed(): void { $configuration = new Configuration(); $processor = new Processor(); @@ -149,7 +149,7 @@ public function testShouldMakeAuthCodeManagerServiceMandatoryIfCustomDriverIsUse ]]); } - public function testShouldLoadCustomDriverConfig() + public function testShouldLoadCustomDriverConfig(): void { $configuration = new Configuration(); $processor = new Processor(); diff --git a/Tests/DependencyInjection/FOSOAuthServerExtensionTest.php b/Tests/DependencyInjection/FOSOAuthServerExtensionTest.php index 9c33906e..945df62e 100644 --- a/Tests/DependencyInjection/FOSOAuthServerExtensionTest.php +++ b/Tests/DependencyInjection/FOSOAuthServerExtensionTest.php @@ -28,7 +28,7 @@ class FOSOAuthServerExtensionTest extends \PHPUnit\Framework\TestCase */ private $container; - public function setUp() + public function setUp(): void { $parameterBag = new ParameterBag(); $this->container = new ContainerBuilder($parameterBag); @@ -36,14 +36,14 @@ public function setUp() parent::setUp(); } - public function testShouldImplementConfigurationInterface() + public function testShouldImplementConfigurationInterface(): void { $rc = new \ReflectionClass(FOSOAuthServerExtension::class); $this->assertTrue($rc->isSubclassOf(Extension::class)); } - public function testCouldBeConstructedWithoutAnyArguments() + public function testCouldBeConstructedWithoutAnyArguments(): void { try { new FOSOAuthServerExtension(); @@ -55,7 +55,7 @@ public function testCouldBeConstructedWithoutAnyArguments() } } - public function testShouldLoadAuthorizeRelatedServicesIfAuthorizationIsEnabled() + public function testShouldLoadAuthorizeRelatedServicesIfAuthorizationIsEnabled(): void { $container = new ContainerBuilder(); @@ -75,7 +75,7 @@ public function testShouldLoadAuthorizeRelatedServicesIfAuthorizationIsEnabled() $this->assertTrue($container->hasDefinition('fos_oauth_server.controller.authorize')); } - public function testShouldNotLoadAuthorizeRelatedServicesIfAuthorizationIsDisabled() + public function testShouldNotLoadAuthorizeRelatedServicesIfAuthorizationIsDisabled(): void { $container = new ContainerBuilder(); @@ -95,7 +95,7 @@ public function testShouldNotLoadAuthorizeRelatedServicesIfAuthorizationIsDisabl $this->assertFalse($container->hasDefinition('fos_oauth_server.controller.authorize')); } - public function testLoadAuthorizeRouting() + public function testLoadAuthorizeRouting(): void { $locator = new FileLocator(); $loader = new XmlFileLoader($locator); @@ -106,7 +106,7 @@ public function testLoadAuthorizeRouting() $this->assertSame(['GET', 'POST'], $authorizeRoute->getMethods()); } - public function testLoadTokenRouting() + public function testLoadTokenRouting(): void { $locator = new FileLocator(); $loader = new XmlFileLoader($locator); @@ -117,7 +117,7 @@ public function testLoadTokenRouting() $this->assertSame(['GET', 'POST'], $tokenRoute->getMethods()); } - public function testWithoutService() + public function testWithoutService(): void { $config = [ 'db_driver' => 'orm', @@ -135,7 +135,7 @@ public function testWithoutService() ); } - public function testStringSupportedScopes() + public function testStringSupportedScopes(): void { $scopes = 'scope1 scope2 scope3 scope4'; @@ -163,7 +163,7 @@ public function testStringSupportedScopes() ); } - public function testArraySupportedScopes() + public function testArraySupportedScopes(): void { $scopes = ['scope1', 'scope2', 'scope3', 'scope4']; @@ -192,7 +192,7 @@ public function testArraySupportedScopes() ); } - public function testArraySupportedScopesWithSpace() + public function testArraySupportedScopesWithSpace(): void { $scopes = ['scope1 scope2', 'scope3', 'scope4']; @@ -216,7 +216,7 @@ public function testArraySupportedScopesWithSpace() $instance->load([$config], $this->container); } - public function testShouldAliasServivesWhenCustomDriverIsUsed() + public function testShouldAliasServivesWhenCustomDriverIsUsed(): void { $container = new ContainerBuilder(); $extension = new FOSOAuthServerExtension(); diff --git a/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php b/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php index 1d8e02d3..301e1712 100644 --- a/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php +++ b/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php @@ -32,24 +32,24 @@ class OAuthFactoryTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { $this->instance = new OAuthFactory(); parent::setUp(); } - public function testGetPosition() + public function testGetPosition(): void { $this->assertSame('pre_auth', $this->instance->getPosition()); } - public function testGetKey() + public function testGetKey(): void { $this->assertSame('fos_oauth', $this->instance->getKey()); } - public function testCreate() + public function testCreate(): void { $container = $this->getMockBuilder(ContainerBuilder::class) ->disableOriginalConstructor() @@ -113,7 +113,7 @@ public function testCreate() ], $this->instance->create($container, $id, $config, $userProvider, $defaultEntryPoint)); } - public function testAddConfigurationDoesNothing() + public function testAddConfigurationDoesNothing(): void { $nodeDefinition = $this->getMockBuilder(NodeDefinition::class) ->disableOriginalConstructor() diff --git a/Tests/Document/AuthCodeManagerTest.php b/Tests/Document/AuthCodeManagerTest.php index f3a86281..68c5a6b2 100644 --- a/Tests/Document/AuthCodeManagerTest.php +++ b/Tests/Document/AuthCodeManagerTest.php @@ -30,12 +30,12 @@ class AuthCodeManagerTest extends \PHPUnit\Framework\TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|DocumentManager + * @var \PHPUnit\Framework\MockObject\MockObject|DocumentManager */ protected $documentManager; /** - * @var \PHPUnit_Framework_MockObject_MockObject|DocumentRepository + * @var \PHPUnit\Framework\MockObject\MockObject|DocumentRepository */ protected $repository; @@ -49,7 +49,7 @@ class AuthCodeManagerTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { if (!class_exists('\Doctrine\ODM\MongoDB\DocumentManager')) { $this->markTestSkipped('Doctrine MongoDB ODM has to be installed for this test to run.'); @@ -77,18 +77,18 @@ public function setUp() parent::setUp(); } - public function testConstructWillSetParameters() + public function testConstructWillSetParameters(): void { $this->assertAttributeSame($this->documentManager, 'dm', $this->instance); $this->assertAttributeSame($this->className, 'class', $this->instance); } - public function testGetClassWillReturnClassName() + public function testGetClassWillReturnClassName(): void { $this->assertSame($this->className, $this->instance->getClass()); } - public function testFindAuthCodeBy() + public function testFindAuthCodeBy(): void { $randomResult = \random_bytes(10); $criteria = [ @@ -105,7 +105,7 @@ public function testFindAuthCodeBy() $this->assertSame($randomResult, $this->instance->findAuthCodeBy($criteria)); } - public function testUpdateAuthCode() + public function testUpdateAuthCode(): void { $authCode = $this->getMockBuilder(AuthCodeInterface::class) ->disableOriginalConstructor() @@ -129,7 +129,7 @@ public function testUpdateAuthCode() $this->assertNull($this->instance->updateAuthCode($authCode)); } - public function testDeleteAuthCode() + public function testDeleteAuthCode(): void { $authCode = $this->getMockBuilder(AuthCodeInterface::class) ->disableOriginalConstructor() @@ -153,7 +153,7 @@ public function testDeleteAuthCode() $this->assertNull($this->instance->deleteAuthCode($authCode)); } - public function testDeleteExpired() + public function testDeleteExpired(): void { $queryBuilder = $this->getMockBuilder(Builder::class) ->disableOriginalConstructor() diff --git a/Tests/Document/ClientManagerTest.php b/Tests/Document/ClientManagerTest.php index 4af23fc8..1bf8bcf4 100644 --- a/Tests/Document/ClientManagerTest.php +++ b/Tests/Document/ClientManagerTest.php @@ -26,7 +26,7 @@ class ClientManagerTest extends \PHPUnit\Framework\TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|DocumentManager + * @var \PHPUnit\Framework\MockObject\MockObject|DocumentManager */ protected $documentManager; @@ -36,7 +36,7 @@ class ClientManagerTest extends \PHPUnit\Framework\TestCase protected $className; /** - * @var \PHPUnit_Framework_MockObject_MockObject|DocumentRepository + * @var \PHPUnit\Framework\MockObject\MockObject|DocumentRepository */ protected $repository; @@ -45,7 +45,7 @@ class ClientManagerTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { if (!class_exists('\Doctrine\ODM\MongoDB\DocumentManager')) { $this->markTestSkipped('Doctrine MongoDB ODM has to be installed for this test to run.'); @@ -73,19 +73,19 @@ public function setUp() parent::setUp(); } - public function testConstructWillSetParameters() + public function testConstructWillSetParameters(): void { $this->assertAttributeSame($this->documentManager, 'dm', $this->instance); $this->assertAttributeSame($this->repository, 'repository', $this->instance); $this->assertAttributeSame($this->className, 'class', $this->instance); } - public function testGetClass() + public function testGetClass(): void { $this->assertSame($this->className, $this->instance->getClass()); } - public function testFindClientBy() + public function testFindClientBy(): void { $randomResult = \random_bytes(5); $criteria = [ @@ -102,7 +102,7 @@ public function testFindClientBy() $this->assertSame($randomResult, $this->instance->findClientBy($criteria)); } - public function testUpdateClient() + public function testUpdateClient(): void { $client = $this->getMockBuilder(ClientInterface::class) ->disableOriginalConstructor() @@ -126,7 +126,7 @@ public function testUpdateClient() $this->assertNull($this->instance->updateClient($client)); } - public function testDeleteClient() + public function testDeleteClient(): void { $client = $this->getMockBuilder(ClientInterface::class) ->disableOriginalConstructor() diff --git a/Tests/Document/TokenManagerTest.php b/Tests/Document/TokenManagerTest.php index ff166d34..a2c93372 100644 --- a/Tests/Document/TokenManagerTest.php +++ b/Tests/Document/TokenManagerTest.php @@ -35,12 +35,12 @@ class TokenManagerTest extends \PHPUnit\Framework\TestCase protected $className; /** - * @var \PHPUnit_Framework_MockObject_MockObject|DocumentManager + * @var \PHPUnit\Framework\MockObject\MockObject|DocumentManager */ protected $documentManager; /** - * @var \PHPUnit_Framework_MockObject_MockObject|DocumentRepository + * @var \PHPUnit\Framework\MockObject\MockObject|DocumentRepository */ protected $repository; @@ -49,7 +49,7 @@ class TokenManagerTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { if (!class_exists('\Doctrine\ODM\MongoDB\DocumentManager')) { $this->markTestSkipped('Doctrine MongoDB ODM has to be installed for this test to run.'); @@ -75,7 +75,7 @@ public function setUp() $this->instance = new TokenManager($this->documentManager, $this->className); } - public function testFindTokenByToken() + public function testFindTokenByToken(): void { $randomToken = \random_bytes(5); $randomResult = \random_bytes(5); @@ -92,7 +92,7 @@ public function testFindTokenByToken() $this->assertSame($randomResult, $this->instance->findTokenByToken($randomToken)); } - public function testUpdateTokenPersistsAndFlushes() + public function testUpdateTokenPersistsAndFlushes(): void { $token = $this->getMockBuilder(AccessToken::class) ->disableOriginalConstructor() @@ -114,12 +114,12 @@ public function testUpdateTokenPersistsAndFlushes() $this->assertNull($this->instance->updateToken($token)); } - public function testGetClass() + public function testGetClass(): void { $this->assertSame($this->className, $this->instance->getClass()); } - public function testDeleteToken() + public function testDeleteToken(): void { $token = $this->getMockBuilder(AccessToken::class) ->disableOriginalConstructor() @@ -143,7 +143,7 @@ public function testDeleteToken() $this->assertNull($this->instance->deleteToken($token)); } - public function testDeleteExpired() + public function testDeleteExpired(): void { $queryBuilder = $this->getMockBuilder(Builder::class) ->disableOriginalConstructor() diff --git a/Tests/Entity/AuthCodeManagerTest.php b/Tests/Entity/AuthCodeManagerTest.php index ccdd9409..eedacf70 100644 --- a/Tests/Entity/AuthCodeManagerTest.php +++ b/Tests/Entity/AuthCodeManagerTest.php @@ -31,7 +31,7 @@ class AuthCodeManagerTest extends \PHPUnit\Framework\TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|EntityManagerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|EntityManagerInterface */ protected $entityManager; @@ -45,7 +45,7 @@ class AuthCodeManagerTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { $this->entityManager = $this->getMockBuilder(EntityManagerInterface::class) ->disableOriginalConstructor() @@ -58,18 +58,18 @@ public function setUp() parent::setUp(); } - public function testConstructWillSetParameters() + public function testConstructWillSetParameters(): void { $this->assertAttributeSame($this->entityManager, 'em', $this->instance); $this->assertAttributeSame($this->className, 'class', $this->instance); } - public function testGetClassWillReturnClassName() + public function testGetClassWillReturnClassName(): void { $this->assertSame($this->className, $this->instance->getClass()); } - public function testFindAuthCodeBy() + public function testFindAuthCodeBy(): void { $repository = $this->getMockBuilder(ObjectRepository::class) ->disableOriginalConstructor() @@ -98,7 +98,7 @@ public function testFindAuthCodeBy() $this->assertSame($randomResult, $this->instance->findAuthCodeBy($criteria)); } - public function testUpdateAuthCode() + public function testUpdateAuthCode(): void { $authCode = $this->getMockBuilder(AuthCodeInterface::class) ->disableOriginalConstructor() @@ -122,7 +122,7 @@ public function testUpdateAuthCode() $this->assertNull($this->instance->updateAuthCode($authCode)); } - public function testDeleteAuthCode() + public function testDeleteAuthCode(): void { $authCode = $this->getMockBuilder(AuthCodeInterface::class) ->disableOriginalConstructor() @@ -146,7 +146,7 @@ public function testDeleteAuthCode() $this->assertNull($this->instance->deleteAuthCode($authCode)); } - public function testDeleteExpired() + public function testDeleteExpired(): void { $randomResult = \random_bytes(10); diff --git a/Tests/Entity/ClientManagerTest.php b/Tests/Entity/ClientManagerTest.php index d575d320..e4958aa7 100644 --- a/Tests/Entity/ClientManagerTest.php +++ b/Tests/Entity/ClientManagerTest.php @@ -26,7 +26,7 @@ class ClientManagerTest extends \PHPUnit\Framework\TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|EntityManagerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|EntityManagerInterface */ protected $entityManager; @@ -36,7 +36,7 @@ class ClientManagerTest extends \PHPUnit\Framework\TestCase protected $className; /** - * @var \PHPUnit_Framework_MockObject_MockObject|EntityRepository + * @var \PHPUnit\Framework\MockObject\MockObject|EntityRepository */ protected $repository; @@ -45,7 +45,7 @@ class ClientManagerTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { $this->entityManager = $this->getMockBuilder(EntityManagerInterface::class) ->disableOriginalConstructor() @@ -69,19 +69,19 @@ public function setUp() parent::setUp(); } - public function testConstructWillSetParameters() + public function testConstructWillSetParameters(): void { $this->assertAttributeSame($this->entityManager, 'em', $this->instance); $this->assertAttributeSame($this->repository, 'repository', $this->instance); $this->assertAttributeSame($this->className, 'class', $this->instance); } - public function testGetClass() + public function testGetClass(): void { $this->assertSame($this->className, $this->instance->getClass()); } - public function testFindClientBy() + public function testFindClientBy(): void { $criteria = [ \random_bytes(5), @@ -98,7 +98,7 @@ public function testFindClientBy() $this->assertSame($randomResult, $this->instance->findClientBy($criteria)); } - public function testUpdateClient() + public function testUpdateClient(): void { $client = $this->getMockBuilder(ClientInterface::class) ->disableOriginalConstructor() @@ -122,7 +122,7 @@ public function testUpdateClient() $this->assertNull($this->instance->updateClient($client)); } - public function testDeleteClient() + public function testDeleteClient(): void { $client = $this->getMockBuilder(ClientInterface::class) ->disableOriginalConstructor() diff --git a/Tests/Entity/TokenManagerTest.php b/Tests/Entity/TokenManagerTest.php index acdeca16..1cc2d834 100644 --- a/Tests/Entity/TokenManagerTest.php +++ b/Tests/Entity/TokenManagerTest.php @@ -32,12 +32,12 @@ class TokenManagerTest extends \PHPUnit\Framework\TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|EntityManagerInterface + * @var \PHPUnit\Framework\MockObject\MockObject|EntityManagerInterface */ protected $entityManager; /** - * @var \PHPUnit_Framework_MockObject_MockObject|EntityRepository + * @var \PHPUnit\Framework\MockObject\MockObject|EntityRepository */ protected $repository; @@ -51,7 +51,7 @@ class TokenManagerTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { $this->className = AccessToken::class; $this->repository = $this->getMockBuilder(EntityRepository::class) @@ -73,14 +73,14 @@ public function setUp() $this->instance = new TokenManager($this->entityManager, $this->className); } - public function testConstructWillSetParameters() + public function testConstructWillSetParameters(): void { $this->assertAttributeSame($this->entityManager, 'em', $this->instance); $this->assertAttributeSame($this->repository, 'repository', $this->instance); $this->assertAttributeSame($this->className, 'class', $this->instance); } - public function testUpdateTokenPersistsAndFlushes() + public function testUpdateTokenPersistsAndFlushes(): void { $token = new AccessToken(); @@ -99,12 +99,12 @@ public function testUpdateTokenPersistsAndFlushes() $this->assertNull($this->instance->updateToken($token)); } - public function testGetClass() + public function testGetClass(): void { $this->assertSame($this->className, $this->instance->getClass()); } - public function testFindTokenBy() + public function testFindTokenBy(): void { $randomResult = \random_bytes(5); @@ -122,7 +122,7 @@ public function testFindTokenBy() $this->assertSame($randomResult, $this->instance->findTokenBy($criteria)); } - public function testUpdateToken() + public function testUpdateToken(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() @@ -146,7 +146,7 @@ public function testUpdateToken() $this->assertNull($this->instance->updateToken($token)); } - public function testDeleteToken() + public function testDeleteToken(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() @@ -170,7 +170,7 @@ public function testDeleteToken() $this->assertNull($this->instance->deleteToken($token)); } - public function testDeleteExpired() + public function testDeleteExpired(): void { $randomResult = \random_bytes(10); diff --git a/Tests/FOSOAuthServerBundleTest.php b/Tests/FOSOAuthServerBundleTest.php index 16482cf9..ba6bb025 100644 --- a/Tests/FOSOAuthServerBundleTest.php +++ b/Tests/FOSOAuthServerBundleTest.php @@ -26,11 +26,11 @@ protected function setUp(): void parent::setUp(); } - public function testConstruction() + public function testConstruction(): void { $bundle = new FOSOAuthServerBundle(); - /** @var ContainerBuilder|\PHPUnit_Framework_MockObject_MockObject $containerBuilder */ + /** @var ContainerBuilder|\PHPUnit\Framework\MockObject\MockObject $containerBuilder */ $containerBuilder = $this->getMockBuilder(ContainerBuilder::class) ->disableOriginalConstructor() ->setMethods([ @@ -40,7 +40,7 @@ public function testConstruction() ->getMock() ; - /** @var SecurityExtension|\PHPUnit_Framework_MockObject_MockObject $securityExtension */ + /** @var SecurityExtension|\PHPUnit\Framework\MockObject\MockObject $securityExtension */ $securityExtension = $this->getMockBuilder(SecurityExtension::class) ->disableOriginalConstructor() ->getMock() diff --git a/Tests/Form/Handler/AuthorizeFormHandlerTest.php b/Tests/Form/Handler/AuthorizeFormHandlerTest.php index f061b515..dd211252 100644 --- a/Tests/Form/Handler/AuthorizeFormHandlerTest.php +++ b/Tests/Form/Handler/AuthorizeFormHandlerTest.php @@ -55,7 +55,7 @@ class AuthorizeFormHandlerTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { $this->form = $this->getMockBuilder(FormInterface::class) ->disableOriginalConstructor() @@ -89,7 +89,7 @@ public function setUp() parent::setUp(); } - public function testConstructWillAcceptRequestObjectAsRequest() + public function testConstructWillAcceptRequestObjectAsRequest(): void { $request = $this->getMockBuilder(Request::class) ->disableOriginalConstructor() @@ -102,7 +102,7 @@ public function testConstructWillAcceptRequestObjectAsRequest() $this->assertAttributeSame($request, 'requestStack', $this->instance); } - public function testConstructWillAcceptRequestStackObjectAsRequest() + public function testConstructWillAcceptRequestStackObjectAsRequest(): void { $requestStack = $this->getMockBuilder(RequestStack::class) ->disableOriginalConstructor() @@ -115,7 +115,7 @@ public function testConstructWillAcceptRequestStackObjectAsRequest() $this->assertAttributeSame($requestStack, 'requestStack', $this->instance); } - public function testConstructWillAcceptNullAsRequest() + public function testConstructWillAcceptNullAsRequest(): void { $this->instance = new AuthorizeFormHandler($this->form, null); $this->assertAttributeSame($this->form, 'form', $this->instance); @@ -126,7 +126,7 @@ public function testConstructWillAcceptNullAsRequest() $this->assertAttributeSame(null, 'requestStack', $this->instance); } - public function testConstructWillThrowException() + public function testConstructWillThrowException(): void { $exceptionMessage = sprintf( 'Argument 2 of %s must be an instanceof RequestStack or Request', @@ -139,7 +139,7 @@ public function testConstructWillThrowException() new AuthorizeFormHandler($this->form, new \stdClass()); } - public function testIsAcceptedWillProxyValueToFormData() + public function testIsAcceptedWillProxyValueToFormData(): void { $data = new \stdClass(); $data->accepted = \random_bytes(10); @@ -154,7 +154,7 @@ public function testIsAcceptedWillProxyValueToFormData() $this->assertSame($data->accepted, $this->instance->isAccepted()); } - public function testIsRejectedWillNegateAcceptedValueFromFormData() + public function testIsRejectedWillNegateAcceptedValueFromFormData(): void { $dataWithAcceptedValueFalse = new \stdClass(); $dataWithAcceptedValueFalse->accepted = false; @@ -175,7 +175,7 @@ public function testIsRejectedWillNegateAcceptedValueFromFormData() $this->assertFalse($this->instance->isRejected()); } - public function testGetScopeWillProxyValueToFormData() + public function testGetScopeWillProxyValueToFormData(): void { $data = new \stdClass(); $data->scope = \random_bytes(10); @@ -190,13 +190,13 @@ public function testGetScopeWillProxyValueToFormData() $this->assertSame($data->scope, $this->instance->getScope()); } - public function testGetCurrentRequestWillReturnRequestObject() + public function testGetCurrentRequestWillReturnRequestObject(): void { $method = $this->getReflectionMethod('getCurrentRequest'); $this->assertSame($this->request, $method->invoke($this->instance)); } - public function testGetCurrentRequestWillReturnCurrentRequestFromRequestStack() + public function testGetCurrentRequestWillReturnCurrentRequestFromRequestStack(): void { $requestStack = $this->getMockBuilder(RequestStack::class) ->disableOriginalConstructor() @@ -217,7 +217,7 @@ public function testGetCurrentRequestWillReturnCurrentRequestFromRequestStack() $this->assertSame($request, $method->invoke($this->instance)); } - public function testGetCurrentRequestWillReturnRequestServiceFromContainerIfNoneIsSet() + public function testGetCurrentRequestWillReturnRequestServiceFromContainerIfNoneIsSet(): void { $this->instance = new AuthorizeFormHandler($this->form, null); $this->instance->setContainer($this->container); @@ -238,7 +238,7 @@ public function testGetCurrentRequestWillReturnRequestServiceFromContainerIfNone /** * @TODO Fix this behavior. This method MUST not modify $_GET. */ - public function testOnSuccessWillReplaceGETSuperGlobal() + public function testOnSuccessWillReplaceGETSuperGlobal(): void { $method = $this->getReflectionMethod('onSuccess'); @@ -271,7 +271,7 @@ public function testOnSuccessWillReplaceGETSuperGlobal() $this->assertSame($expectedSuperGlobalValue, $_GET); } - public function testProcessWillReturnFalseIfRequestIsNull() + public function testProcessWillReturnFalseIfRequestIsNull(): void { $this->instance = new AuthorizeFormHandler($this->form, null); $this->instance->setContainer($this->container); @@ -286,7 +286,7 @@ public function testProcessWillReturnFalseIfRequestIsNull() $this->assertFalse($this->instance->process()); } - public function testProcessWillSetFormData() + public function testProcessWillSetFormData(): void { $this->requestRequest ->expects($this->once()) @@ -320,7 +320,7 @@ public function testProcessWillSetFormData() $this->assertFalse($this->instance->process()); } - public function testProcessWillHandleRequestOnPost() + public function testProcessWillHandleRequestOnPost(): void { $this->requestRequest ->expects($this->once()) @@ -382,7 +382,7 @@ public function testProcessWillHandleRequestOnPost() $this->assertFalse($this->instance->process()); } - public function testProcessWillHandleRequestOnPostAndWillProcessDataIfFormIsValid() + public function testProcessWillHandleRequestOnPostAndWillProcessDataIfFormIsValid(): void { $this->requestRequest ->expects($this->once()) diff --git a/Tests/Form/Type/AuthorizeFormTypeTest.php b/Tests/Form/Type/AuthorizeFormTypeTest.php index dc11d839..74185fbd 100644 --- a/Tests/Form/Type/AuthorizeFormTypeTest.php +++ b/Tests/Form/Type/AuthorizeFormTypeTest.php @@ -41,7 +41,7 @@ protected function setUp(): void $this->instance = new AuthorizeFormType(); } - public function testSubmit() + public function testSubmit(): void { $accepted = true; $formData = [ @@ -70,9 +70,9 @@ public function testSubmit() } } - public function testConfigureOptionsWillSetDefaultsOnTheOptionsResolver() + public function testConfigureOptionsWillSetDefaultsOnTheOptionsResolver(): void { - /** @var \PHPUnit_Framework_MockObject_MockObject|OptionsResolver $resolver */ + /** @var \PHPUnit\Framework\MockObject\MockObject|OptionsResolver $resolver */ $resolver = $this->getMockBuilder(OptionsResolver::class) ->disableOriginalConstructor() ->getMock() @@ -90,12 +90,12 @@ public function testConfigureOptionsWillSetDefaultsOnTheOptionsResolver() $this->assertNull($this->instance->configureOptions($resolver)); } - public function testGetName() + public function testGetName(): void { $this->assertSame('fos_oauth_server_authorize', $this->instance->getName()); } - public function testGetBlockPrefix() + public function testGetBlockPrefix(): void { $this->assertSame('fos_oauth_server_authorize', $this->instance->getBlockPrefix()); } diff --git a/Tests/Functional/BootTest.php b/Tests/Functional/BootTest.php index 4e3d56f1..393c5bd9 100644 --- a/Tests/Functional/BootTest.php +++ b/Tests/Functional/BootTest.php @@ -20,7 +20,7 @@ class BootTest extends TestCase * * @param string $env */ - public function testBoot($env) + public function testBoot($env): void { try { $kernel = static::createKernel(['env' => $env]); diff --git a/Tests/Model/TokenTest.php b/Tests/Model/TokenTest.php index e010cbb1..fcad561f 100644 --- a/Tests/Model/TokenTest.php +++ b/Tests/Model/TokenTest.php @@ -30,7 +30,7 @@ class TokenTest extends TestCase * @param mixed $expiresAt * @param mixed $expect */ - public function testHasExpired($expiresAt, $expect) + public function testHasExpired($expiresAt, $expect): void { $token = new Token(); $token->setExpiresAt($expiresAt); @@ -50,14 +50,14 @@ public static function getTestHasExpiredData() ]; } - public function testExpiresIn() + public function testExpiresIn(): void { $token = new Token(); $this->assertSame(PHP_INT_MAX, $token->getExpiresIn()); } - public function testExpiresInWithExpiresAt() + public function testExpiresInWithExpiresAt(): void { $token = new Token(); $token->setExpiresAt(time() + 60); diff --git a/Tests/Propel/AuthCodeManagerTest.php b/Tests/Propel/AuthCodeManagerTest.php index 4d49a57e..a8b1be60 100644 --- a/Tests/Propel/AuthCodeManagerTest.php +++ b/Tests/Propel/AuthCodeManagerTest.php @@ -28,7 +28,7 @@ class AuthCodeManagerTest extends PropelTestCase protected $manager; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -36,17 +36,17 @@ public function setUp() AuthCodeQuery::create()->deleteAll(); } - public function testConstruct() + public function testConstruct(): void { $this->assertSame(self::AUTH_CODE_CLASS, $this->manager->getClass()); } - public function testCreateClass() + public function testCreateClass(): void { $this->assertInstanceOf(self::AUTH_CODE_CLASS, $this->manager->createAuthCode()); } - public function testUpdate() + public function testUpdate(): void { $authCode = $this->getMockBuilder('FOS\OAuthServerBundle\Propel\AuthCode') ->disableOriginalConstructor() @@ -60,7 +60,7 @@ public function testUpdate() $this->manager->updateAuthCode($authCode); } - public function testDelete() + public function testDelete(): void { $authCode = $this->getMockBuilder('FOS\OAuthServerBundle\Propel\AuthCode') ->disableOriginalConstructor() @@ -74,14 +74,14 @@ public function testDelete() $this->manager->deleteAuthCode($authCode); } - public function testFindAuthCodeReturnsNullIfNotFound() + public function testFindAuthCodeReturnsNullIfNotFound(): void { $authCode = $this->manager->findAuthCodeBy(['token' => '12345']); $this->assertNull($authCode); } - public function testFindAuthCode() + public function testFindAuthCode(): void { $authCode = $this->createAuthCode('12345'); $return = $this->manager->findAuthCodeBy(['token' => '12345']); @@ -90,7 +90,7 @@ public function testFindAuthCode() $this->assertSame($authCode, $return); } - public function testFindAuthCodeByToken() + public function testFindAuthCodeByToken(): void { $authCode = $this->createAuthCode('12345'); $return = $this->manager->findAuthCodeByToken('12345'); @@ -99,14 +99,14 @@ public function testFindAuthCodeByToken() $this->assertSame($authCode, $return); } - public function testFindAuthCodeByTokenReturnsNullIfNotFound() + public function testFindAuthCodeByTokenReturnsNullIfNotFound(): void { $return = $this->manager->findAuthCodeByToken('12345'); $this->assertNull($return); } - public function testFindAuthCodeWithInvalidData() + public function testFindAuthCodeWithInvalidData(): void { $token = $this->manager->findAuthCodeBy(['foo' => '12345']); $this->assertNull($token); @@ -118,7 +118,7 @@ public function testFindAuthCodeWithInvalidData() $this->assertNull($token); } - public function testDeleteExpired() + public function testDeleteExpired(): void { $a1 = $this->createAuthCode('12345', time() + 100); $a2 = $this->createAuthCode('67890', time() - 100); diff --git a/Tests/Propel/AuthCodeTest.php b/Tests/Propel/AuthCodeTest.php index e8993bc4..1a54c55a 100644 --- a/Tests/Propel/AuthCodeTest.php +++ b/Tests/Propel/AuthCodeTest.php @@ -28,7 +28,7 @@ class AuthCodeTest extends PropelTestCase * @param mixed $expiresAt * @param mixed $expect */ - public function testHasExpired($expiresAt, $expect) + public function testHasExpired($expiresAt, $expect): void { $token = new AuthCode(); $token->setExpiresAt($expiresAt); @@ -45,14 +45,14 @@ public static function getTestHasExpiredData() ]; } - public function testExpiresIn() + public function testExpiresIn(): void { $token = new AuthCode(); $this->assertSame(PHP_INT_MAX, $token->getExpiresIn()); } - public function testExpiresInWithExpiresAt() + public function testExpiresInWithExpiresAt(): void { $token = new AuthCode(); $token->setExpiresAt(time() + 60); diff --git a/Tests/Propel/ClientManagerTest.php b/Tests/Propel/ClientManagerTest.php index 16bea8c6..60c44fee 100644 --- a/Tests/Propel/ClientManagerTest.php +++ b/Tests/Propel/ClientManagerTest.php @@ -23,7 +23,7 @@ class ClientManagerTest extends PropelTestCase protected $manager; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -31,17 +31,17 @@ public function setUp() ClientQuery::create()->deleteAll(); } - public function testConstruct() + public function testConstruct(): void { $this->assertSame(self::CLIENT_CLASS, $this->manager->getClass()); } - public function testCreateClass() + public function testCreateClass(): void { $this->assertInstanceOf(self::CLIENT_CLASS, $this->manager->createClient()); } - public function testUpdate() + public function testUpdate(): void { $client = $this->getMockBuilder('FOS\OAuthServerBundle\Propel\Client') ->disableOriginalConstructor() @@ -55,7 +55,7 @@ public function testUpdate() $this->manager->updateClient($client); } - public function testDelete() + public function testDelete(): void { $client = $this->getMockBuilder('FOS\OAuthServerBundle\Propel\Client') ->disableOriginalConstructor() @@ -69,14 +69,14 @@ public function testDelete() $this->manager->deleteClient($client); } - public function testFindClientReturnsNullIfNotFound() + public function testFindClientReturnsNullIfNotFound(): void { $client = $this->manager->findClientBy(['id' => '1', 'randomId' => '2345']); $this->assertNull($client); } - public function testFindClientWithInvalidCriteria() + public function testFindClientWithInvalidCriteria(): void { $client = $this->manager->findClientBy(['randomId' => '2345']); $this->assertNull($client); @@ -88,7 +88,7 @@ public function testFindClientWithInvalidCriteria() $this->assertNull($client); } - public function testFindClient() + public function testFindClient(): void { $client = $this->createClient('2345'); $return = $this->manager->findClientBy(['id' => '1', 'randomId' => '2345']); @@ -97,7 +97,7 @@ public function testFindClient() $this->assertSame($client, $return); } - public function testFindClientByPublicId() + public function testFindClientByPublicId(): void { $client = $this->createClient('12345'); $return = $this->manager->findClientByPublicId('1_12345'); @@ -106,14 +106,14 @@ public function testFindClientByPublicId() $this->assertSame($client, $return); } - public function testFindClientByPublicIdReturnsNullIfNotFound() + public function testFindClientByPublicIdReturnsNullIfNotFound(): void { $return = $this->manager->findClientByPublicId('1_12345'); $this->assertNull($return); } - public function testFindClientByPublicIdReturnsNullIfInvalidPublicId() + public function testFindClientByPublicIdReturnsNullIfInvalidPublicId(): void { $return = $this->manager->findClientByPublicId('1'); $this->assertNull($return); diff --git a/Tests/Propel/ClientTest.php b/Tests/Propel/ClientTest.php index f10cb282..c2f3d2b9 100644 --- a/Tests/Propel/ClientTest.php +++ b/Tests/Propel/ClientTest.php @@ -18,7 +18,7 @@ class ClientTest extends PropelTestCase { - public function testConstructor() + public function testConstructor(): void { $client = new Client(); @@ -30,7 +30,7 @@ public function testConstructor() $this->assertSame(OAuth2::GRANT_TYPE_AUTH_CODE, $types[0]); } - public function testCheckSecretWithInvalidArgument() + public function testCheckSecretWithInvalidArgument(): void { $client = new Client(); @@ -39,7 +39,7 @@ public function testCheckSecretWithInvalidArgument() $this->assertFalse($client->checkSecret(null)); } - public function testCheckSecret() + public function testCheckSecret(): void { $client = new Client(); $client->setSecret('foo'); diff --git a/Tests/Propel/PropelTestCase.php b/Tests/Propel/PropelTestCase.php index c0b65fba..7ad41b66 100644 --- a/Tests/Propel/PropelTestCase.php +++ b/Tests/Propel/PropelTestCase.php @@ -17,7 +17,7 @@ class PropelTestCase extends TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('\Propel')) { $this->markTestSkipped('Propel is not installed.'); diff --git a/Tests/Propel/TokenManagerTest.php b/Tests/Propel/TokenManagerTest.php index 6de63827..58b73610 100644 --- a/Tests/Propel/TokenManagerTest.php +++ b/Tests/Propel/TokenManagerTest.php @@ -28,7 +28,7 @@ class TokenManagerTest extends PropelTestCase protected $manager; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -36,18 +36,18 @@ public function setUp() TokenQuery::create()->deleteAll(); } - public function testConstruct() + public function testConstruct(): void { $this->assertSame(self::TOKEN_CLASS, $this->manager->getClass()); } - public function testCreateClass() + public function testCreateClass(): void { $this->manager = new TokenManager('Token'); $this->assertInstanceOf('Token', $this->manager->createToken()); } - public function testUpdate() + public function testUpdate(): void { $token = $this->getMockBuilder('FOS\OAuthServerBundle\Propel\Token') ->disableOriginalConstructor() @@ -61,7 +61,7 @@ public function testUpdate() $this->manager->updateToken($token); } - public function testDelete() + public function testDelete(): void { $token = $this->getMockBuilder('FOS\OAuthServerBundle\Propel\Token') ->disableOriginalConstructor() @@ -75,14 +75,14 @@ public function testDelete() $this->manager->deleteToken($token); } - public function testFindTokenReturnsNullIfNotFound() + public function testFindTokenReturnsNullIfNotFound(): void { $token = $this->manager->findTokenBy(['token' => '12345']); $this->assertNull($token); } - public function testFindTokenWithInvalidData() + public function testFindTokenWithInvalidData(): void { $token = $this->manager->findTokenBy(['foo' => '12345']); $this->assertNull($token); @@ -94,7 +94,7 @@ public function testFindTokenWithInvalidData() $this->assertNull($token); } - public function testFindToken() + public function testFindToken(): void { $token = $this->createToken('12345'); $return = $this->manager->findTokenBy(['token' => '12345']); @@ -103,7 +103,7 @@ public function testFindToken() $this->assertSame($token, $return); } - public function testFindTokenByToken() + public function testFindTokenByToken(): void { $token = $this->createToken('12345'); $return = $this->manager->findTokenByToken('12345'); @@ -112,14 +112,14 @@ public function testFindTokenByToken() $this->assertSame($token, $return); } - public function testFindTokenByTokenReturnsNullIfNotFound() + public function testFindTokenByTokenReturnsNullIfNotFound(): void { $return = $this->manager->findTokenByToken('12345'); $this->assertNull($return); } - public function testDeleteExpired() + public function testDeleteExpired(): void { $a1 = $this->createToken('12345', time() + 100); $a2 = $this->createToken('67890', time() - 100); diff --git a/Tests/Propel/TokenTest.php b/Tests/Propel/TokenTest.php index 6ad9e931..cf1ff30f 100644 --- a/Tests/Propel/TokenTest.php +++ b/Tests/Propel/TokenTest.php @@ -28,7 +28,7 @@ class TokenTest extends PropelTestCase * @param mixed $expiresAt * @param mixed $expect */ - public function testHasExpired($expiresAt, $expect) + public function testHasExpired($expiresAt, $expect): void { $token = new Token(); $token->setExpiresAt($expiresAt); @@ -45,14 +45,14 @@ public static function getTestHasExpiredData() ]; } - public function testExpiresIn() + public function testExpiresIn(): void { $token = new Token(); $this->assertSame(PHP_INT_MAX, $token->getExpiresIn()); } - public function testExpiresInWithExpiresAt() + public function testExpiresInWithExpiresAt(): void { $token = new Token(); $token->setExpiresAt(time() + 60); diff --git a/Tests/Security/Authentication/Provider/OAuthProviderTest.php b/Tests/Security/Authentication/Provider/OAuthProviderTest.php index 01865280..da106c93 100644 --- a/Tests/Security/Authentication/Provider/OAuthProviderTest.php +++ b/Tests/Security/Authentication/Provider/OAuthProviderTest.php @@ -24,12 +24,12 @@ class OAuthProviderTest extends \PHPUnit\Framework\TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|UserInterface + * @var \PHPUnit\Framework\MockObject\MockObject|UserInterface */ protected $user; /** - * @var \PHPUnit_Framework_MockObject_MockObject|UserProviderInterface + * @var \PHPUnit\Framework\MockObject\MockObject|UserProviderInterface */ protected $userProvider; @@ -39,7 +39,7 @@ class OAuthProviderTest extends \PHPUnit\Framework\TestCase protected $provider; /** - * @var \PHPUnit_Framework_MockObject_MockObject|OAuth2 + * @var \PHPUnit\Framework\MockObject\MockObject|OAuth2 */ protected $serverService; @@ -48,7 +48,7 @@ class OAuthProviderTest extends \PHPUnit\Framework\TestCase */ protected $userChecker; - public function setUp() + public function setUp(): void { $this->user = $this->getMockBuilder(UserInterface::class) ->disableOriginalConstructor() @@ -70,7 +70,7 @@ public function setUp() $this->provider = new OAuthProvider($this->userProvider, $this->serverService, $this->userChecker); } - public function testAuthenticateReturnsTokenIfValid() + public function testAuthenticateReturnsTokenIfValid(): void { $token = new OAuthToken(); $token->setToken('x'); @@ -99,7 +99,7 @@ public function testAuthenticateReturnsTokenIfValid() $this->assertSame('ROLE_USER', $roles[0]); } - public function testAuthenticateReturnsTokenIfValidEvenIfNullData() + public function testAuthenticateReturnsTokenIfValidEvenIfNullData(): void { $token = new OAuthToken(); $token->setToken('x'); @@ -119,7 +119,7 @@ public function testAuthenticateReturnsTokenIfValidEvenIfNullData() $this->assertCount(0, $result->getRoleNames()); } - public function testAuthenticateTransformsScopesAsRoles() + public function testAuthenticateTransformsScopesAsRoles(): void { $token = new OAuthToken(); $token->setToken('x'); @@ -144,7 +144,7 @@ public function testAuthenticateTransformsScopesAsRoles() $this->assertSame('ROLE_BAR', $roles[1]); } - public function testAuthenticateWithNullScope() + public function testAuthenticateWithNullScope(): void { $this->markTestIncomplete('Scope is not nullable'); @@ -167,7 +167,7 @@ public function testAuthenticateWithNullScope() $this->assertCount(0, $result->getRoleNames()); } - public function testAuthenticateWithEmptyScope() + public function testAuthenticateWithEmptyScope(): void { $token = new OAuthToken(); $token->setToken('x'); diff --git a/Tests/Security/Authentification/Token/OAuthTokenTest.php b/Tests/Security/Authentification/Token/OAuthTokenTest.php index 196d5969..d43c858a 100644 --- a/Tests/Security/Authentification/Token/OAuthTokenTest.php +++ b/Tests/Security/Authentification/Token/OAuthTokenTest.php @@ -23,14 +23,14 @@ class OAuthTokenTest extends \PHPUnit\Framework\TestCase */ protected $instance; - public function setUp() + public function setUp(): void { $this->instance = new OAuthToken(); parent::setUp(); } - public function testSetTokenWillSetToken() + public function testSetTokenWillSetToken(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() @@ -41,7 +41,7 @@ public function testSetTokenWillSetToken() $this->assertSame($token, $this->instance->getToken()); } - public function testGetTokenWillReturnToken() + public function testGetTokenWillReturnToken(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() @@ -53,7 +53,7 @@ public function testGetTokenWillReturnToken() $this->assertSame($token, $this->instance->getToken()); } - public function testGetCredentialsWillReturnToken() + public function testGetCredentialsWillReturnToken(): void { $token = $this->getMockBuilder(TokenInterface::class) ->disableOriginalConstructor() diff --git a/Tests/Security/Firewall/OAuthListenerTest.php b/Tests/Security/Firewall/OAuthListenerTest.php index 6961b5d2..2d63a4e8 100644 --- a/Tests/Security/Firewall/OAuthListenerTest.php +++ b/Tests/Security/Firewall/OAuthListenerTest.php @@ -43,7 +43,7 @@ class OAuthListenerTest extends TestCase */ protected $event; - public function setUp() + public function setUp(): void { $this->serverService = $this->getMockBuilder(OAuth2::class) ->disableOriginalConstructor() @@ -76,7 +76,7 @@ public function setUp() ; } - public function testHandle() + public function testHandle(): void { $listener = new OAuthListener($this->securityContext, $this->authManager, $this->serverService); @@ -105,7 +105,7 @@ public function testHandle() $this->assertSame('a-token', $token->getToken()); } - public function testHandleResponse() + public function testHandleResponse(): void { $listener = new OAuthListener($this->securityContext, $this->authManager, $this->serverService); diff --git a/Tests/Storage/OAuthStorageTest.php b/Tests/Storage/OAuthStorageTest.php index b8e1c2de..ca70e609 100644 --- a/Tests/Storage/OAuthStorageTest.php +++ b/Tests/Storage/OAuthStorageTest.php @@ -58,7 +58,7 @@ class OAuthStorageTest extends \PHPUnit\Framework\TestCase */ protected $storage; - public function setUp() + public function setUp(): void { $this->clientManager = $this->getMockBuilder(ClientManagerInterface::class) ->disableOriginalConstructor() @@ -88,7 +88,7 @@ public function setUp() $this->storage = new OAuthStorage($this->clientManager, $this->accessTokenManager, $this->refreshTokenManager, $this->authCodeManager, $this->userProvider, $this->encoderFactory); } - public function testGetClientReturnsClientWithGivenId() + public function testGetClientReturnsClientWithGivenId(): void { $client = new Client(); @@ -101,7 +101,7 @@ public function testGetClientReturnsClientWithGivenId() $this->assertSame($client, $this->storage->getClient('123_abc')); } - public function testGetClientReturnsNullIfNotExists() + public function testGetClientReturnsNullIfNotExists(): void { $client = new Client(); @@ -114,7 +114,7 @@ public function testGetClientReturnsNullIfNotExists() $this->assertNull($this->storage->getClient('123_abc')); } - public function testCheckClientCredentialsThrowsIfInvalidClientClass() + public function testCheckClientCredentialsThrowsIfInvalidClientClass(): void { $client = $this->getMockBuilder('OAuth2\Model\IOAuth2Client') ->disableOriginalConstructor() @@ -125,7 +125,7 @@ public function testCheckClientCredentialsThrowsIfInvalidClientClass() $this->storage->checkClientCredentials($client, 'dummy'); } - public function testCheckClientCredentialsReturnsTrueOnValidCredentials() + public function testCheckClientCredentialsReturnsTrueOnValidCredentials(): void { $client = new Client(); $client->setSecret('dummy'); @@ -133,7 +133,7 @@ public function testCheckClientCredentialsReturnsTrueOnValidCredentials() $this->assertTrue($this->storage->checkClientCredentials($client, 'dummy')); } - public function testCheckClientCredentialsReturnsFalseOnValidCredentials() + public function testCheckClientCredentialsReturnsFalseOnValidCredentials(): void { $client = new Client(); $client->setSecret('dummy'); @@ -141,7 +141,7 @@ public function testCheckClientCredentialsReturnsFalseOnValidCredentials() $this->assertFalse($this->storage->checkClientCredentials($client, 'passe')); } - public function testGetAccessTokenReturnsAccessTokenWithGivenId() + public function testGetAccessTokenReturnsAccessTokenWithGivenId(): void { $token = new AccessToken(); @@ -154,7 +154,7 @@ public function testGetAccessTokenReturnsAccessTokenWithGivenId() $this->assertSame($token, $this->storage->getAccessToken('123_abc')); } - public function testGetAccessTokenReturnsNullIfNotExists() + public function testGetAccessTokenReturnsNullIfNotExists(): void { $token = new AccessToken(); @@ -167,7 +167,7 @@ public function testGetAccessTokenReturnsNullIfNotExists() $this->assertNull($this->storage->getAccessToken('123_abc')); } - public function testCreateAccessTokenThrowsOnInvalidClientClass() + public function testCreateAccessTokenThrowsOnInvalidClientClass(): void { $client = $this->getMockBuilder('OAuth2\Model\IOAuth2Client') ->disableOriginalConstructor() @@ -178,7 +178,7 @@ public function testCreateAccessTokenThrowsOnInvalidClientClass() $this->storage->createAccessToken('foo', $client, new User(42), 1, 'foo bar'); } - public function testCreateAccessToken() + public function testCreateAccessToken(): void { $savedToken = null; @@ -209,7 +209,7 @@ public function testCreateAccessToken() $this->assertSame('foo bar', $token->getScope()); } - public function testCreateAccessTokenWithoutUser() + public function testCreateAccessTokenWithoutUser(): void { $savedToken = null; @@ -233,7 +233,7 @@ public function testCreateAccessTokenWithoutUser() $this->assertSame($token, $savedToken); } - public function testGetRefreshTokenReturnsRefreshTokenWithGivenId() + public function testGetRefreshTokenReturnsRefreshTokenWithGivenId(): void { $token = new RefreshToken(); @@ -246,7 +246,7 @@ public function testGetRefreshTokenReturnsRefreshTokenWithGivenId() $this->assertSame($token, $this->storage->getRefreshToken('123_abc')); } - public function testGetRefreshTokenReturnsNullIfNotExists() + public function testGetRefreshTokenReturnsNullIfNotExists(): void { $this->refreshTokenManager->expects($this->once()) ->method('findTokenByToken') @@ -257,7 +257,7 @@ public function testGetRefreshTokenReturnsNullIfNotExists() $this->assertNull($this->storage->getRefreshToken('123_abc')); } - public function testCreateRefreshTokenThrowsOnInvalidClientClass() + public function testCreateRefreshTokenThrowsOnInvalidClientClass(): void { $client = $this->getMockBuilder('OAuth2\Model\IOAuth2Client') ->disableOriginalConstructor() @@ -268,7 +268,7 @@ public function testCreateRefreshTokenThrowsOnInvalidClientClass() $this->storage->createRefreshToken('foo', $client, 42, 1, 'foo bar'); } - public function testCreateRefreshToken() + public function testCreateRefreshToken(): void { $savedToken = null; @@ -299,7 +299,7 @@ public function testCreateRefreshToken() $this->assertSame('foo bar', $token->getScope()); } - public function testCreateRefreshTokenWithoutUser() + public function testCreateRefreshTokenWithoutUser(): void { $savedToken = null; @@ -323,7 +323,7 @@ public function testCreateRefreshTokenWithoutUser() $this->assertSame($token, $savedToken); } - public function testCheckRestrictedGrantTypeThrowsOnInvalidClientClass() + public function testCheckRestrictedGrantTypeThrowsOnInvalidClientClass(): void { $client = $this->getMockBuilder('OAuth2\Model\IOAuth2Client') ->disableOriginalConstructor() @@ -335,7 +335,7 @@ public function testCheckRestrictedGrantTypeThrowsOnInvalidClientClass() $this->storage->checkRestrictedGrantType($client, 'foo'); } - public function testCheckRestrictedGrantType() + public function testCheckRestrictedGrantType(): void { $client = new Client(); $client->setAllowedGrantTypes(['foo', 'bar']); @@ -345,7 +345,7 @@ public function testCheckRestrictedGrantType() $this->assertFalse($this->storage->checkRestrictedGrantType($client, 'baz')); } - public function testCheckUserCredentialsThrowsOnInvalidClientClass() + public function testCheckUserCredentialsThrowsOnInvalidClientClass(): void { $client = $this->getMockBuilder('OAuth2\Model\IOAuth2Client') ->disableOriginalConstructor() @@ -357,7 +357,7 @@ public function testCheckUserCredentialsThrowsOnInvalidClientClass() $this->storage->checkUserCredentials($client, 'Joe', 'baz'); } - public function testCheckUserCredentialsCatchesAuthenticationExceptions() + public function testCheckUserCredentialsCatchesAuthenticationExceptions(): void { $client = new Client(); @@ -373,7 +373,7 @@ public function testCheckUserCredentialsCatchesAuthenticationExceptions() $this->assertFalse($result); } - public function testCheckUserCredentialsReturnsTrueOnValidCredentials() + public function testCheckUserCredentialsReturnsTrueOnValidCredentials(): void { $client = new Client(); $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface') @@ -412,7 +412,7 @@ public function testCheckUserCredentialsReturnsTrueOnValidCredentials() ], $this->storage->checkUserCredentials($client, 'Joe', 'baz')); } - public function testCheckUserCredentialsReturnsFalseOnInvalidCredentials() + public function testCheckUserCredentialsReturnsFalseOnInvalidCredentials(): void { $client = new Client(); $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface') @@ -449,7 +449,7 @@ public function testCheckUserCredentialsReturnsFalseOnInvalidCredentials() $this->assertFalse($this->storage->checkUserCredentials($client, 'Joe', 'baz')); } - public function testCheckUserCredentialsReturnsFalseIfUserNotExist() + public function testCheckUserCredentialsReturnsFalseIfUserNotExist(): void { $client = new Client(); @@ -462,7 +462,7 @@ public function testCheckUserCredentialsReturnsFalseIfUserNotExist() $this->assertFalse($this->storage->checkUserCredentials($client, 'Joe', 'baz')); } - public function testCreateAuthCodeThrowsOnInvalidClientClass() + public function testCreateAuthCodeThrowsOnInvalidClientClass(): void { $client = $this->getMockBuilder('OAuth2\Model\IOAuth2Client') ->disableOriginalConstructor() @@ -473,7 +473,7 @@ public function testCreateAuthCodeThrowsOnInvalidClientClass() $this->storage->createAuthCode('foo', $client, 42, 'http://www.example.com/', 1, 'foo bar'); } - public function testCreateAuthCode() + public function testCreateAuthCode(): void { $savedCode = null; @@ -504,7 +504,7 @@ public function testCreateAuthCode() $this->assertSame('foo bar', $code->getScope()); } - public function testGetAuthCodeReturnsAuthCodeWithGivenId() + public function testGetAuthCodeReturnsAuthCodeWithGivenId(): void { $code = new AuthCode(); @@ -517,7 +517,7 @@ public function testGetAuthCodeReturnsAuthCodeWithGivenId() $this->assertSame($code, $this->storage->getAuthCode('123_abc')); } - public function testGetAuthCodeReturnsNullIfNotExists() + public function testGetAuthCodeReturnsNullIfNotExists(): void { $this->authCodeManager->expects($this->once()) ->method('findAuthCodeByToken') @@ -528,7 +528,7 @@ public function testGetAuthCodeReturnsNullIfNotExists() $this->assertNull($this->storage->getAuthCode('123_abc')); } - public function testValidGrantExtension() + public function testValidGrantExtension(): void { $grantExtension = $this->getMockBuilder('FOS\OAuthServerBundle\Storage\GrantExtensionInterface') ->disableOriginalConstructor() @@ -548,7 +548,7 @@ public function testValidGrantExtension() $this->assertTrue($this->storage->checkGrantExtension($client, 'https://friendsofsymfony.com/grants/foo', [], [])); } - public function testInvalidGrantExtension() + public function testInvalidGrantExtension(): void { $this->expectException(\OAuth2\OAuth2ServerException::class); @@ -559,7 +559,7 @@ public function testInvalidGrantExtension() $this->storage->checkGrantExtension($client, 'https://friendsofsymfony.com/grants/bar', [], []); } - public function testDoubleSetGrantExtension() + public function testDoubleSetGrantExtension(): void { $grantExtension = $this->getMockBuilder('FOS\OAuthServerBundle\Storage\GrantExtensionInterface') ->disableOriginalConstructor() @@ -580,7 +580,7 @@ public function testDoubleSetGrantExtension() $this->assertSame($grantExtension2, $grantExtensions[$uri]); } - public function testMarkAuthCodeAsUsedIfAuthCodeFound() + public function testMarkAuthCodeAsUsedIfAuthCodeFound(): void { $authCode = $this->getMockBuilder('FOS\OAuthServerBundle\Model\AuthCodeInterface') ->disableOriginalConstructor() @@ -602,7 +602,7 @@ public function testMarkAuthCodeAsUsedIfAuthCodeFound() $this->storage->markAuthCodeAsUsed('123_abc'); } - public function testMarkAuthCodeAsUsedIfAuthCodeNotFound() + public function testMarkAuthCodeAsUsedIfAuthCodeNotFound(): void { $this->authCodeManager->expects($this->atLeastOnce()) ->method('findAuthCodeByToken') diff --git a/Tests/Util/RandomTest.php b/Tests/Util/RandomTest.php index 830232a9..93ea7601 100644 --- a/Tests/Util/RandomTest.php +++ b/Tests/Util/RandomTest.php @@ -25,7 +25,7 @@ class RandomTest extends \PHPUnit\Framework\TestCase { use PHPMock; - public function setUp() + public function setUp(): void { parent::setUp(); } @@ -33,7 +33,7 @@ public function setUp() /** * @runInSeparateProcess */ - public function testGenerateTokenWillUseRandomBytesIfAvailable() + public function testGenerateTokenWillUseRandomBytesIfAvailable(): void { $hashResult = \random_bytes(32);