diff --git a/.gitignore b/.gitignore index c3f54875..668bc28d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ Propel/om/ Propel/map/ composer.lock .php_cs.cache +.phpunit.result.cache \ No newline at end of file diff --git a/Document/AuthCodeManager.php b/Document/AuthCodeManager.php index bdcc2ad1..97bc46d9 100644 --- a/Document/AuthCodeManager.php +++ b/Document/AuthCodeManager.php @@ -14,7 +14,7 @@ namespace FOS\OAuthServerBundle\Document; use Doctrine\ODM\MongoDB\DocumentManager; -use Doctrine\ODM\MongoDB\DocumentRepository; +use Doctrine\ODM\MongoDB\Repository\DocumentRepository; use FOS\OAuthServerBundle\Model\AuthCodeInterface; use FOS\OAuthServerBundle\Model\AuthCodeManager as BaseAuthCodeManager; diff --git a/Document/TokenManager.php b/Document/TokenManager.php index 9050924d..44974215 100644 --- a/Document/TokenManager.php +++ b/Document/TokenManager.php @@ -14,7 +14,7 @@ namespace FOS\OAuthServerBundle\Document; use Doctrine\ODM\MongoDB\DocumentManager; -use Doctrine\ODM\MongoDB\DocumentRepository; +use Doctrine\ODM\MongoDB\Repository\DocumentRepository; use FOS\OAuthServerBundle\Model\TokenInterface; use FOS\OAuthServerBundle\Model\TokenManager as BaseTokenManager; diff --git a/Tests/BypassFinalHook.php b/Tests/BypassFinalHook.php new file mode 100644 index 00000000..1b5fae31 --- /dev/null +++ b/Tests/BypassFinalHook.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\OAuthServerBundle\Tests; + +use DG\BypassFinals; +use PHPUnit\Runner\BeforeTestHook; + +final class BypassFinalHook implements BeforeTestHook +{ + public function executeBeforeTest(string $test): void + { + BypassFinals::enable(); + } +} \ No newline at end of file diff --git a/Tests/Command/CleanCommandTest.php b/Tests/Command/CleanCommandTest.php index 214495df..5291d9d1 100644 --- a/Tests/Command/CleanCommandTest.php +++ b/Tests/Command/CleanCommandTest.php @@ -92,9 +92,9 @@ public function testItShouldRemoveExpiredToken(): void $display = $tester->getDisplay(); - $this->assertContains(sprintf('Removed %d items from %s storage.', $expiredAccessTokens, get_class($this->accessTokenManager)), $display); - $this->assertContains(sprintf('Removed %d items from %s storage.', $expiredRefreshTokens, get_class($this->refreshTokenManager)), $display); - $this->assertContains(sprintf('Removed %d items from %s storage.', $expiredAuthCodes, get_class($this->authCodeManager)), $display); + $this->assertStringContainsString(sprintf('Removed %d items from %s storage.', $expiredAccessTokens, get_class($this->accessTokenManager)), $display); + $this->assertStringContainsString(sprintf('Removed %d items from %s storage.', $expiredRefreshTokens, get_class($this->refreshTokenManager)), $display); + $this->assertStringContainsString(sprintf('Removed %d items from %s storage.', $expiredAuthCodes, get_class($this->authCodeManager)), $display); } /** @@ -109,8 +109,8 @@ public function testItShouldNotRemoveExpiredTokensForOtherClasses(): void $display = $tester->getDisplay(); - $this->assertNotRegExp(sprintf('\'Removed (\d)+ items from %s storage.\'', get_class($this->accessTokenManager)), $display); - $this->assertNotRegExp(sprintf('\'Removed (\d)+ items from %s storage.\'', get_class($this->refreshTokenManager)), $display); - $this->assertNotRegExp(sprintf('\'Removed (\d)+ items from %s storage.\'', get_class($this->authCodeManager)), $display); + $this->assertDoesNotMatchRegularExpression(sprintf('\'Removed (\d)+ items from %s storage.\'', get_class($this->accessTokenManager)), $display); + $this->assertDoesNotMatchRegularExpression(sprintf('\'Removed (\d)+ items from %s storage.\'', get_class($this->refreshTokenManager)), $display); + $this->assertDoesNotMatchRegularExpression(sprintf('\'Removed (\d)+ items from %s storage.\'', get_class($this->authCodeManager)), $display); } } diff --git a/Tests/Command/CreateClientCommandTest.php b/Tests/Command/CreateClientCommandTest.php index 124e09f0..670eaaf0 100644 --- a/Tests/Command/CreateClientCommandTest.php +++ b/Tests/Command/CreateClientCommandTest.php @@ -80,8 +80,8 @@ public function testItShouldCreateClient($client): void $output = $commandTester->getDisplay(); - $this->assertContains('Client ID', $output); - $this->assertContains('Client Secret', $output); + $this->assertStringContainsString('Client ID', $output); + $this->assertStringContainsString('Client Secret', $output); } /** diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 52fb2607..c14fc1bd 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -44,29 +44,45 @@ public function testShouldNotMandatoryServiceIfNotCustomDriverIsUsed(): void $configuration = new Configuration(); $processor = new Processor(); - $config = $processor->processConfiguration($configuration, [[ - 'db_driver' => 'orm', - 'client_class' => 'aClientClass', - 'access_token_class' => 'anAccessTokenClass', - 'refresh_token_class' => 'aRefreshTokenClass', - 'auth_code_class' => 'anAuthCodeClass', - ]]); - - $this->assertArraySubset([ - 'db_driver' => 'orm', - 'client_class' => 'aClientClass', - 'access_token_class' => 'anAccessTokenClass', - 'refresh_token_class' => 'aRefreshTokenClass', - 'auth_code_class' => 'anAuthCodeClass', - 'service' => [ - 'storage' => 'fos_oauth_server.storage.default', - 'user_provider' => null, - 'client_manager' => 'fos_oauth_server.client_manager.default', - 'access_token_manager' => 'fos_oauth_server.access_token_manager.default', - 'refresh_token_manager' => 'fos_oauth_server.refresh_token_manager.default', - 'auth_code_manager' => 'fos_oauth_server.auth_code_manager.default', - ], - ], $config); + $config = $processor->processConfiguration($configuration, [ + [ + 'db_driver' => 'orm', + 'client_class' => 'aClientClass', + 'access_token_class' => 'anAccessTokenClass', + 'refresh_token_class' => 'aRefreshTokenClass', + 'auth_code_class' => 'anAuthCodeClass', + ] + ]); + + $this->assertSame( + [ + 'db_driver' => 'orm', + 'client_class' => 'aClientClass', + 'access_token_class' => 'anAccessTokenClass', + 'refresh_token_class' => 'aRefreshTokenClass', + 'auth_code_class' => 'anAuthCodeClass', + 'model_manager_name' => null, + 'authorize' => [ + 'form' => [ + 'type' => 'fos_oauth_server_authorize', + 'handler' => 'fos_oauth_server.authorize.form.handler.default', + 'name' => 'fos_oauth_server_authorize_form', + 'validation_groups' => [ + 0 => 'Authorize', + 1 => 'Default', + ], + ], + ], + 'service' => [ + 'storage' => 'fos_oauth_server.storage.default', + 'user_provider' => null, + 'client_manager' => 'fos_oauth_server.client_manager.default', + 'access_token_manager' => 'fos_oauth_server.access_token_manager.default', + 'refresh_token_manager' => 'fos_oauth_server.refresh_token_manager.default', + 'auth_code_manager' => 'fos_oauth_server.auth_code_manager.default', + 'options' => [], + ], + ], $config); } public function testShouldMakeClientManagerServiceMandatoryIfCustomDriverIsUsed(): void @@ -77,13 +93,15 @@ public function testShouldMakeClientManagerServiceMandatoryIfCustomDriverIsUsed( $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessage('Invalid configuration for path "fos_oauth_server": The service client_manager must be set explicitly for custom db_driver.'); - $processor->processConfiguration($configuration, [[ - 'db_driver' => 'custom', - 'client_class' => 'aClientClass', - 'access_token_class' => 'anAccessTokenClass', - 'refresh_token_class' => 'aRefreshTokenClass', - 'auth_code_class' => 'anAuthCodeClass', - ]]); + $processor->processConfiguration($configuration, [ + [ + 'db_driver' => 'custom', + 'client_class' => 'aClientClass', + 'access_token_class' => 'anAccessTokenClass', + 'refresh_token_class' => 'aRefreshTokenClass', + 'auth_code_class' => 'anAuthCodeClass', + ] + ]); } public function testShouldMakeAccessTokenManagerServiceMandatoryIfCustomDriverIsUsed(): void @@ -94,16 +112,18 @@ public function testShouldMakeAccessTokenManagerServiceMandatoryIfCustomDriverIs $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessage('Invalid configuration for path "fos_oauth_server": The service access_token_manager must be set explicitly for custom db_driver.'); - $processor->processConfiguration($configuration, [[ - 'db_driver' => 'custom', - 'client_class' => 'aClientClass', - 'access_token_class' => 'anAccessTokenClass', - 'refresh_token_class' => 'aRefreshTokenClass', - 'auth_code_class' => 'anAuthCodeClass', - 'service' => [ - 'client_manager' => 'a_client_manager_id', - ], - ]]); + $processor->processConfiguration($configuration, [ + [ + 'db_driver' => 'custom', + 'client_class' => 'aClientClass', + 'access_token_class' => 'anAccessTokenClass', + 'refresh_token_class' => 'aRefreshTokenClass', + 'auth_code_class' => 'anAuthCodeClass', + 'service' => [ + 'client_manager' => 'a_client_manager_id', + ], + ] + ]); } public function testShouldMakeRefreshTokenManagerServiceMandatoryIfCustomDriverIsUsed(): void @@ -114,17 +134,19 @@ public function testShouldMakeRefreshTokenManagerServiceMandatoryIfCustomDriverI $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessage('Invalid configuration for path "fos_oauth_server": The service refresh_token_manager must be set explicitly for custom db_driver.'); - $processor->processConfiguration($configuration, [[ - 'db_driver' => 'custom', - 'client_class' => 'aClientClass', - 'access_token_class' => 'anAccessTokenClass', - 'refresh_token_class' => 'aRefreshTokenClass', - 'auth_code_class' => 'anAuthCodeClass', - 'service' => [ - 'client_manager' => 'a_client_manager_id', - 'access_token_manager' => 'anId', - ], - ]]); + $processor->processConfiguration($configuration, [ + [ + 'db_driver' => 'custom', + 'client_class' => 'aClientClass', + 'access_token_class' => 'anAccessTokenClass', + 'refresh_token_class' => 'aRefreshTokenClass', + 'auth_code_class' => 'anAuthCodeClass', + 'service' => [ + 'client_manager' => 'a_client_manager_id', + 'access_token_manager' => 'anId', + ], + ] + ]); } public function testShouldMakeAuthCodeManagerServiceMandatoryIfCustomDriverIsUsed(): void @@ -135,18 +157,20 @@ public function testShouldMakeAuthCodeManagerServiceMandatoryIfCustomDriverIsUse $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessage('Invalid configuration for path "fos_oauth_server": The service auth_code_manager must be set explicitly for custom db_driver.'); - $processor->processConfiguration($configuration, [[ - 'db_driver' => 'custom', - 'client_class' => 'aClientClass', - 'access_token_class' => 'anAccessTokenClass', - 'refresh_token_class' => 'aRefreshTokenClass', - 'auth_code_class' => 'anAuthCodeClass', - 'service' => [ - 'client_manager' => 'a_client_manager_id', - 'access_token_manager' => 'anId', - 'refresh_token_manager' => 'anId', - ], - ]]); + $processor->processConfiguration($configuration, [ + [ + 'db_driver' => 'custom', + 'client_class' => 'aClientClass', + 'access_token_class' => 'anAccessTokenClass', + 'refresh_token_class' => 'aRefreshTokenClass', + 'auth_code_class' => 'anAuthCodeClass', + 'service' => [ + 'client_manager' => 'a_client_manager_id', + 'access_token_manager' => 'anId', + 'refresh_token_manager' => 'anId', + ], + ] + ]); } public function testShouldLoadCustomDriverConfig(): void @@ -154,7 +178,23 @@ public function testShouldLoadCustomDriverConfig(): void $configuration = new Configuration(); $processor = new Processor(); - $config = $processor->processConfiguration($configuration, [[ + $config = $processor->processConfiguration($configuration, [ + [ + 'db_driver' => 'custom', + 'client_class' => 'aClientClass', + 'access_token_class' => 'anAccessTokenClass', + 'refresh_token_class' => 'aRefreshTokenClass', + 'auth_code_class' => 'anAuthCodeClass', + 'service' => [ + 'client_manager' => 'a_client_manager_id', + 'access_token_manager' => 'an_access_token_manager_id', + 'refresh_token_manager' => 'a_refresh_token_manager_id', + 'auth_code_manager' => 'an_auth_code_manager_id', + ], + ] + ]); + + $this->assertSame([ 'db_driver' => 'custom', 'client_class' => 'aClientClass', 'access_token_class' => 'anAccessTokenClass', @@ -165,22 +205,21 @@ public function testShouldLoadCustomDriverConfig(): void 'access_token_manager' => 'an_access_token_manager_id', 'refresh_token_manager' => 'a_refresh_token_manager_id', 'auth_code_manager' => 'an_auth_code_manager_id', - ], - ]]); - - $this->assertArraySubset([ - 'db_driver' => 'custom', - 'client_class' => 'aClientClass', - 'access_token_class' => 'anAccessTokenClass', - 'refresh_token_class' => 'aRefreshTokenClass', - 'auth_code_class' => 'anAuthCodeClass', - 'service' => [ 'storage' => 'fos_oauth_server.storage.default', 'user_provider' => null, - 'client_manager' => 'a_client_manager_id', - 'access_token_manager' => 'an_access_token_manager_id', - 'refresh_token_manager' => 'a_refresh_token_manager_id', - 'auth_code_manager' => 'an_auth_code_manager_id', + 'options' => [], + ], + 'model_manager_name' => null, + 'authorize' => [ + 'form' => [ + 'type' => 'fos_oauth_server_authorize', + 'handler' => 'fos_oauth_server.authorize.form.handler.default', + 'name' => 'fos_oauth_server_authorize_form', + 'validation_groups' => [ + 0 => 'Authorize', + 1 => 'Default', + ], + ], ], ], $config); } diff --git a/Tests/Document/AuthCodeManagerTest.php b/Tests/Document/AuthCodeManagerTest.php index 68c5a6b2..3874bde2 100644 --- a/Tests/Document/AuthCodeManagerTest.php +++ b/Tests/Document/AuthCodeManagerTest.php @@ -13,12 +13,13 @@ namespace FOS\OAuthServerBundle\Tests\Document; -use Doctrine\MongoDB\Query\Builder; use Doctrine\ODM\MongoDB\DocumentManager; -use Doctrine\ODM\MongoDB\DocumentRepository; -use Doctrine\ORM\AbstractQuery; +use Doctrine\ODM\MongoDB\Query\Builder; +use Doctrine\ODM\MongoDB\Repository\DocumentRepository; +use Doctrine\ODM\MongoDB\Query\Query; use FOS\OAuthServerBundle\Document\AuthCodeManager; use FOS\OAuthServerBundle\Model\AuthCodeInterface; +use stdClass; /** * @group time-sensitive @@ -77,12 +78,6 @@ public function setUp(): void parent::setUp(); } - public function testConstructWillSetParameters(): void - { - $this->assertAttributeSame($this->documentManager, 'dm', $this->instance); - $this->assertAttributeSame($this->className, 'class', $this->instance); - } - public function testGetClassWillReturnClassName(): void { $this->assertSame($this->className, $this->instance->getClass()); @@ -90,7 +85,7 @@ public function testGetClassWillReturnClassName(): void public function testFindAuthCodeBy(): void { - $randomResult = \random_bytes(10); + $resultObject = new stdClass(); $criteria = [ \random_bytes(10), ]; @@ -99,10 +94,10 @@ public function testFindAuthCodeBy(): void ->expects($this->once()) ->method('findOneBy') ->with($criteria) - ->willReturn($randomResult) + ->willReturn($resultObject) ; - $this->assertSame($randomResult, $this->instance->findAuthCodeBy($criteria)); + $this->assertSame($resultObject, $this->instance->findAuthCodeBy($criteria)); } public function testUpdateAuthCode(): void @@ -188,7 +183,7 @@ public function testDeleteExpired(): void ->willReturn($queryBuilder) ; - $query = $this->getMockBuilder(AbstractQuery::class) + $query = $this->getMockBuilder(Query::class) ->disableOriginalConstructor() ->getMock() ; diff --git a/Tests/Document/ClientManagerTest.php b/Tests/Document/ClientManagerTest.php index 1bf8bcf4..fe76a3bd 100644 --- a/Tests/Document/ClientManagerTest.php +++ b/Tests/Document/ClientManagerTest.php @@ -14,9 +14,10 @@ namespace FOS\OAuthServerBundle\Tests\Document; use Doctrine\ODM\MongoDB\DocumentManager; -use Doctrine\ODM\MongoDB\DocumentRepository; +use Doctrine\ODM\MongoDB\Repository\DocumentRepository; use FOS\OAuthServerBundle\Document\ClientManager; use FOS\OAuthServerBundle\Model\ClientInterface; +use stdClass; /** * Class ClientManagerTest. @@ -73,13 +74,6 @@ public function setUp(): void parent::setUp(); } - 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(): void { $this->assertSame($this->className, $this->instance->getClass()); @@ -87,7 +81,7 @@ public function testGetClass(): void public function testFindClientBy(): void { - $randomResult = \random_bytes(5); + $returnObject = new stdClass(); $criteria = [ \random_bytes(5), ]; @@ -96,10 +90,10 @@ public function testFindClientBy(): void ->expects($this->once()) ->method('findOneBy') ->with($criteria) - ->willReturn($randomResult) + ->willReturn($returnObject) ; - $this->assertSame($randomResult, $this->instance->findClientBy($criteria)); + $this->assertSame($returnObject, $this->instance->findClientBy($criteria)); } public function testUpdateClient(): void diff --git a/Tests/Document/TokenManagerTest.php b/Tests/Document/TokenManagerTest.php index a2c93372..8edd3f88 100644 --- a/Tests/Document/TokenManagerTest.php +++ b/Tests/Document/TokenManagerTest.php @@ -13,12 +13,13 @@ namespace FOS\OAuthServerBundle\Tests\Document; -use Doctrine\MongoDB\Query\Query; +use Doctrine\ODM\MongoDB\Query\Query; use Doctrine\ODM\MongoDB\DocumentManager; -use Doctrine\ODM\MongoDB\DocumentRepository; +use Doctrine\ODM\MongoDB\Repository\DocumentRepository; use Doctrine\ODM\MongoDB\Query\Builder; use FOS\OAuthServerBundle\Document\AccessToken; use FOS\OAuthServerBundle\Document\TokenManager; +use stdClass; /** * @group time-sensitive @@ -78,7 +79,7 @@ public function setUp(): void public function testFindTokenByToken(): void { $randomToken = \random_bytes(5); - $randomResult = \random_bytes(5); + $returnObject = new stdClass(); $this->repository ->expects($this->once()) @@ -86,10 +87,10 @@ public function testFindTokenByToken(): void ->with([ 'token' => $randomToken, ]) - ->willReturn($randomResult) + ->willReturn($returnObject) ; - $this->assertSame($randomResult, $this->instance->findTokenByToken($randomToken)); + $this->assertSame($returnObject, $this->instance->findTokenByToken($randomToken)); } public function testUpdateTokenPersistsAndFlushes(): void diff --git a/Tests/Entity/AuthCodeManagerTest.php b/Tests/Entity/AuthCodeManagerTest.php index eedacf70..e0332047 100644 --- a/Tests/Entity/AuthCodeManagerTest.php +++ b/Tests/Entity/AuthCodeManagerTest.php @@ -13,7 +13,7 @@ namespace FOS\OAuthServerBundle\Tests\Entity; -use Doctrine\Common\Persistence\ObjectRepository; +use Doctrine\Persistence\ObjectRepository; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; @@ -58,12 +58,6 @@ public function setUp(): void parent::setUp(); } - public function testConstructWillSetParameters(): void - { - $this->assertAttributeSame($this->entityManager, 'em', $this->instance); - $this->assertAttributeSame($this->className, 'class', $this->instance); - } - public function testGetClassWillReturnClassName(): void { $this->assertSame($this->className, $this->instance->getClass()); diff --git a/Tests/Entity/ClientManagerTest.php b/Tests/Entity/ClientManagerTest.php index e4958aa7..d26f30e2 100644 --- a/Tests/Entity/ClientManagerTest.php +++ b/Tests/Entity/ClientManagerTest.php @@ -69,13 +69,6 @@ public function setUp(): void parent::setUp(); } - 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(): void { $this->assertSame($this->className, $this->instance->getClass()); diff --git a/Tests/Entity/TokenManagerTest.php b/Tests/Entity/TokenManagerTest.php index 1cc2d834..268dd0fd 100644 --- a/Tests/Entity/TokenManagerTest.php +++ b/Tests/Entity/TokenManagerTest.php @@ -73,13 +73,6 @@ public function setUp(): void $this->instance = new TokenManager($this->entityManager, $this->className); } - 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(): void { $token = new AccessToken(); diff --git a/Tests/FOSOAuthServerBundleTest.php b/Tests/FOSOAuthServerBundleTest.php index ba6bb025..6ad9ee3d 100644 --- a/Tests/FOSOAuthServerBundleTest.php +++ b/Tests/FOSOAuthServerBundleTest.php @@ -64,8 +64,8 @@ public function testConstruction(): void ->expects($this->at(1)) ->method('addCompilerPass') ->withConsecutive( - new Compiler\GrantExtensionsCompilerPass(), - new Compiler\RequestStackCompilerPass() + [new Compiler\GrantExtensionsCompilerPass()], + [new Compiler\RequestStackCompilerPass()], ) ->willReturnOnConsecutiveCalls( $containerBuilder, diff --git a/Tests/Form/Handler/AuthorizeFormHandlerTest.php b/Tests/Form/Handler/AuthorizeFormHandlerTest.php index dd211252..88ddabb7 100644 --- a/Tests/Form/Handler/AuthorizeFormHandlerTest.php +++ b/Tests/Form/Handler/AuthorizeFormHandlerTest.php @@ -89,6 +89,9 @@ public function setUp(): void parent::setUp(); } + /** + * @doesNotPerformAssertions + */ public function testConstructWillAcceptRequestObjectAsRequest(): void { $request = $this->getMockBuilder(Request::class) @@ -96,12 +99,12 @@ public function testConstructWillAcceptRequestObjectAsRequest(): void ->getMock() ; - $this->instance = new AuthorizeFormHandler($this->form, $request); - - $this->assertAttributeSame($this->form, 'form', $this->instance); - $this->assertAttributeSame($request, 'requestStack', $this->instance); + new AuthorizeFormHandler($this->form, $request); } + /** + * @doesNotPerformAssertions + */ public function testConstructWillAcceptRequestStackObjectAsRequest(): void { $requestStack = $this->getMockBuilder(RequestStack::class) @@ -109,21 +112,16 @@ public function testConstructWillAcceptRequestStackObjectAsRequest(): void ->getMock() ; - $this->instance = new AuthorizeFormHandler($this->form, $requestStack); - - $this->assertAttributeSame($this->form, 'form', $this->instance); - $this->assertAttributeSame($requestStack, 'requestStack', $this->instance); + new AuthorizeFormHandler($this->form, $requestStack); } + /** + * @doesNotPerformAssertions + */ public function testConstructWillAcceptNullAsRequest(): void { - $this->instance = new AuthorizeFormHandler($this->form, null); - $this->assertAttributeSame($this->form, 'form', $this->instance); - $this->assertAttributeSame(null, 'requestStack', $this->instance); - - $this->instance = new AuthorizeFormHandler($this->form); - $this->assertAttributeSame($this->form, 'form', $this->instance); - $this->assertAttributeSame(null, 'requestStack', $this->instance); + new AuthorizeFormHandler($this->form, null); + new AuthorizeFormHandler($this->form); } public function testConstructWillThrowException(): void diff --git a/composer.json b/composer.json index ca79a1e7..1a42fc36 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,10 @@ ], "require": { "php": "^7.2 || ^8.0", + "doctrine/annotations": "^1.13", "friendsofsymfony/oauth2-php": "~1.1", "symfony/dependency-injection": "^4.4 || ^5.1", + "symfony/form": "^4.4 || ^5.1", "symfony/framework-bundle": "^4.4 || ^5.1", "symfony/security-bundle": "^4.4 || ^5.1", "symfony/twig-bundle": "^4.4 || ^5.1" @@ -31,6 +33,7 @@ "twig/twig": "<1.40 || >=2.0,<2.9" }, "require-dev": { + "dg/bypass-finals": "^1.3", "doctrine/doctrine-bundle": "^2.0", "doctrine/mongodb-odm": "^2.2", "doctrine/orm": "~2.2", @@ -41,7 +44,6 @@ "phpunit/phpunit": "^9.0", "propel/propel1": "~1.6", "symfony/console": "^4.4 || ^5.1", - "symfony/form": "^4.4 || ^5.1", "symfony/phpunit-bridge": "^4.4 || ^5.1", "symfony/yaml": "^4.4 || ^5.1", "willdurand/propel-typehintable-behavior": "~1.0" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5192b311..e61b46b6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,30 +1,31 @@ - - - - ./Tests - - - - - - ./ - - ./Resources - ./Tests - ./vendor - ./Propel/AccessToken.php - ./Propel/AccessTokenQuery.php - ./Propel/RefreshToken.php - ./Propel/RefreshTokenQuery.php - ./Propel - ./Propel/map - ./Propel/om - - - - - - - + + + + ./ + + + ./Resources + ./Tests + ./vendor + ./Propel/AccessToken.php + ./Propel/AccessTokenQuery.php + ./Propel/RefreshToken.php + ./Propel/RefreshTokenQuery.php + ./Propel + ./Propel/map + ./Propel/om + + + + + ./Tests + + + + + + + +