From 4fb67df612b46f0fb508e852c9b729dfb531ffd6 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Thu, 30 May 2019 16:56:20 +0200 Subject: [PATCH] Use willReturn() instead of will(returnValue()). --- .php_cs.dist | 2 - .../DoctrineDataCollectorTest.php | 8 +- .../DoctrineExtensionTest.php | 4 +- .../DoctrineParserCacheTest.php | 4 +- .../Tests/Form/DoctrineOrmTypeGuesserTest.php | 22 ++-- .../Form/Type/EntityTypePerformanceTest.php | 4 +- .../Tests/Form/Type/EntityTypeTest.php | 4 +- .../Security/User/EntityUserProviderTest.php | 2 +- .../Constraints/UniqueEntityValidatorTest.php | 24 ++-- .../Tests/Handler/ConsoleHandlerTest.php | 8 +- .../Tests/Processor/WebProcessorTest.php | 4 +- .../Extension/HttpKernelExtensionTest.php | 8 +- .../Tests/CacheWarmer/TemplateFinderTest.php | 2 +- .../TemplatePathsCacheWarmerTest.php | 6 +- .../Tests/Command/RouterDebugCommandTest.php | 6 +- .../Tests/Command/RouterMatchCommandTest.php | 8 +- .../Command/TranslationDebugCommandTest.php | 32 +++--- .../Command/TranslationUpdateCommandTest.php | 36 +++--- .../Tests/Console/ApplicationTest.php | 10 +- .../Controller/ControllerNameParserTest.php | 10 +- .../Controller/ControllerResolverTest.php | 2 +- .../Tests/Controller/ControllerTraitTest.php | 10 +- .../Controller/RedirectControllerTest.php | 20 ++-- .../Controller/TemplateControllerTest.php | 8 +- .../Tests/Routing/RouterTest.php | 4 +- .../Tests/Templating/DelegatingEngineTest.php | 8 +- .../Tests/Templating/GlobalVariablesTest.php | 6 +- .../Templating/Loader/TemplateLocatorTest.php | 2 +- .../Templating/TemplateNameParserTest.php | 4 +- .../Tests/Templating/TimedPhpEngineTest.php | 6 +- .../Tests/Translation/TranslatorTest.php | 32 +++--- .../ConstraintValidatorFactoryTest.php | 2 +- .../Security/Factory/AbstractFactoryTest.php | 6 +- .../Controller/PreviewErrorControllerTest.php | 2 +- .../Tests/Loader/FilesystemLoaderTest.php | 10 +- .../TwigBundle/Tests/TemplateIteratorTest.php | 8 +- .../Controller/ProfilerControllerTest.php | 6 +- .../Csp/ContentSecurityPolicyHandlerTest.php | 2 +- .../WebDebugToolbarListenerTest.php | 10 +- .../Tests/Profiler/TemplateManagerTest.php | 8 +- .../Component/Asset/Tests/PathPackageTest.php | 2 +- .../Component/Asset/Tests/UrlPackageTest.php | 2 +- .../Cache/Tests/Adapter/ChainAdapterTest.php | 4 +- .../Tests/Adapter/TagAwareAdapterTest.php | 4 +- .../Cache/Tests/Simple/ChainCacheTest.php | 4 +- .../Tests/Loader/DelegatingLoaderTest.php | 8 +- .../Tests/Loader/LoaderResolverTest.php | 2 +- .../Config/Tests/Loader/LoaderTest.php | 12 +- .../Console/Tests/ApplicationTest.php | 4 +- .../Console/Tests/Command/CommandTest.php | 2 +- .../Helper/AbstractQuestionHelperTest.php | 2 +- .../Console/Tests/Helper/HelperSetTest.php | 2 +- .../Tests/Helper/QuestionHelperTest.php | 2 +- .../Helper/SymfonyQuestionHelperTest.php | 2 +- .../Tests/Logger/ConsoleLoggerTest.php | 2 +- .../Debug/Tests/ErrorHandlerTest.php | 10 +- .../Compiler/AutowireExceptionPassTest.php | 20 ++-- .../MergeExtensionConfigurationPassTest.php | 12 +- ...ContainerParametersResourceCheckerTest.php | 4 +- .../Tests/ContainerBuilderTest.php | 4 +- .../Component/DomCrawler/Tests/FormTest.php | 4 +- .../Tests/ImmutableEventDispatcherTest.php | 6 +- .../Tests/ExpressionLanguageTest.php | 20 ++-- .../Tests/Iterator/FilterIteratorTest.php | 4 +- .../Form/Tests/AbstractDivLayoutTest.php | 2 +- .../Form/Tests/AbstractRequestHandlerTest.php | 4 +- .../Form/Tests/AbstractTableLayoutTest.php | 2 +- .../Factory/CachingFactoryDecoratorTest.php | 74 ++++++------ .../Factory/PropertyAccessDecoratorTest.php | 72 ++++++------ .../Tests/ChoiceList/LazyChoiceListTest.php | 30 ++--- .../Component/Form/Tests/CompoundFormTest.php | 42 +++---- .../DataTransformerChainTest.php | 8 +- .../Csrf/Type/FormTypeCsrfExtensionTest.php | 16 +-- .../DataCollector/FormDataCollectorTest.php | 106 +++++++++--------- .../DataCollector/FormDataExtractorTest.php | 8 +- .../Type/FormTypeValidatorExtensionTest.php | 2 +- .../Component/Form/Tests/FormBuilderTest.php | 8 +- .../Component/Form/Tests/FormFactoryTest.php | 100 ++++++++--------- .../Form/Tests/ResolvedFormTypeTest.php | 40 +++---- .../Component/Form/Tests/SimpleFormTest.php | 8 +- .../HttpFoundation/Tests/File/FileTest.php | 2 +- .../Handler/MemcacheSessionHandlerTest.php | 4 +- .../Handler/MemcachedSessionHandlerTest.php | 6 +- .../Handler/MongoDbSessionHandlerTest.php | 32 +++--- .../Storage/Handler/PdoSessionHandlerTest.php | 10 +- .../Handler/WriteCheckSessionHandlerTest.php | 10 +- .../Storage/Proxy/SessionHandlerProxyTest.php | 8 +- .../CacheWarmer/CacheWarmerAggregateTest.php | 2 +- .../Component/HttpKernel/Tests/ClientTest.php | 2 +- .../Tests/Config/FileLocatorTest.php | 2 +- .../ContainerControllerResolverTest.php | 32 +++--- .../Controller/ControllerResolverTest.php | 2 +- .../DataCollector/LoggerDataCollectorTest.php | 8 +- .../DataCollector/TimeDataCollectorTest.php | 2 +- .../Debug/TraceableEventDispatcherTest.php | 8 +- .../LazyLoadingFragmentHandlerTest.php | 16 +-- .../AddRequestFormatsListenerTest.php | 2 +- .../DebugHandlersListenerTest.php | 2 +- .../EventListener/ExceptionListenerTest.php | 8 +- .../EventListener/LocaleListenerTest.php | 6 +- .../EventListener/ProfilerListenerTest.php | 2 +- .../EventListener/RouterListenerTest.php | 8 +- .../EventListener/TestSessionListenerTest.php | 12 +- .../EventListener/TranslatorListenerTest.php | 2 +- .../Tests/Fragment/FragmentHandlerTest.php | 4 +- .../Fragment/InlineFragmentRendererTest.php | 14 +-- .../HttpKernel/Tests/HttpCache/EsiTest.php | 4 +- .../HttpKernel/Tests/HttpCache/SsiTest.php | 4 +- .../HttpKernel/Tests/HttpKernelTest.php | 4 +- .../Component/HttpKernel/Tests/KernelTest.php | 56 ++++----- .../HttpKernel/Tests/Log/LoggerTest.php | 2 +- .../Bundle/Reader/BundleEntryReaderTest.php | 58 +++++----- .../Component/Ldap/Tests/LdapClientTest.php | 6 +- src/Symfony/Component/Ldap/Tests/LdapTest.php | 2 +- .../Tests/ProcessFailedExceptionTest.php | 26 ++--- .../Tests/PropertyAccessorCollectionTest.php | 6 +- .../Loader/AnnotationClassLoaderTest.php | 26 ++--- .../Loader/AnnotationDirectoryLoaderTest.php | 10 +- .../Tests/Loader/AnnotationFileLoaderTest.php | 2 +- .../Tests/Loader/ObjectRouteLoaderTest.php | 2 +- .../Matcher/RedirectableUrlMatcherTest.php | 10 +- .../Tests/RouteCollectionBuilderTest.php | 18 +-- .../Component/Routing/Tests/RouterTest.php | 6 +- .../AuthenticationProviderManagerTest.php | 4 +- .../AnonymousAuthenticationProviderTest.php | 2 +- .../DaoAuthenticationProviderTest.php | 36 +++--- .../LdapBindAuthenticationProviderTest.php | 10 +- ...uthenticatedAuthenticationProviderTest.php | 12 +- .../RememberMeAuthenticationProviderTest.php | 6 +- .../SimpleAuthenticationProviderTest.php | 12 +- .../UserAuthenticationProviderTest.php | 28 ++--- .../Token/AbstractTokenTest.php | 2 +- .../Token/RememberMeTokenTest.php | 2 +- .../AccessDecisionManagerTest.php | 6 +- .../AuthorizationCheckerTest.php | 8 +- .../Voter/ExpressionVoterTest.php | 4 +- .../Authorization/Voter/RoleVoterTest.php | 2 +- .../Tests/Encoder/UserPasswordEncoderTest.php | 14 +-- .../Security/Core/Tests/SecurityTest.php | 10 +- .../Core/Tests/User/ChainUserProviderTest.php | 16 +-- .../Core/Tests/User/LdapUserProviderTest.php | 86 +++++++------- .../Core/Tests/User/UserCheckerTest.php | 22 ++-- .../Constraints/UserPasswordValidatorTest.php | 14 +-- .../Csrf/Tests/CsrfTokenManagerTest.php | 22 ++-- .../FormLoginAuthenticatorTest.php | 4 +- .../GuardAuthenticationListenerTest.php | 34 +++--- .../Tests/GuardAuthenticatorHandlerTest.php | 8 +- .../GuardAuthenticationProviderTest.php | 28 ++--- .../Security/Http/Tests/AccessMapTest.php | 2 +- ...efaultAuthenticationFailureHandlerTest.php | 18 +-- ...efaultAuthenticationSuccessHandlerTest.php | 4 +- .../SimpleAuthenticationHandlerTest.php | 20 ++-- .../FormAuthenticationEntryPointTest.php | 6 +- .../AbstractPreAuthenticatedListenerTest.php | 32 +++--- .../Tests/Firewall/AccessListenerTest.php | 32 +++--- .../AnonymousAuthenticationListenerTest.php | 6 +- .../BasicAuthenticationListenerTest.php | 24 ++-- .../Tests/Firewall/ChannelListenerTest.php | 28 ++--- .../Tests/Firewall/ContextListenerTest.php | 22 ++-- .../DigestAuthenticationListenerTest.php | 4 +- .../Tests/Firewall/ExceptionListenerTest.php | 14 +-- .../Tests/Firewall/LogoutListenerTest.php | 26 ++--- .../Tests/Firewall/RememberMeListenerTest.php | 70 ++++++------ .../SimplePreAuthenticationListenerTest.php | 8 +- .../Tests/Firewall/SwitchUserListenerTest.php | 18 +-- ...PasswordFormAuthenticationListenerTest.php | 10 +- ...PasswordJsonAuthenticationListenerTest.php | 2 +- .../Security/Http/Tests/FirewallMapTest.php | 8 +- .../Security/Http/Tests/FirewallTest.php | 6 +- .../Security/Http/Tests/HttpUtilsTest.php | 14 +-- .../DefaultLogoutSuccessHandlerTest.php | 2 +- .../Tests/Logout/SessionLogoutHandlerTest.php | 2 +- .../AbstractRememberMeServicesTest.php | 26 ++--- ...istentTokenBasedRememberMeServicesTest.php | 22 ++-- .../Tests/RememberMe/ResponseListenerTest.php | 6 +- .../TokenBasedRememberMeServicesTest.php | 24 ++-- .../SessionAuthenticationStrategyTest.php | 2 +- .../Tests/Encoder/ChainDecoderTest.php | 8 +- .../Tests/Encoder/ChainEncoderTest.php | 8 +- .../Factory/CacheMetadataFactoryTest.php | 4 +- .../Factory/ClassMetadataFactoryTest.php | 4 +- .../Normalizer/ArrayDenormalizerTest.php | 8 +- .../Normalizer/GetSetMethodNormalizerTest.php | 2 +- .../JsonSerializableNormalizerTest.php | 8 +- .../Tests/Normalizer/ObjectNormalizerTest.php | 2 +- .../Templating/Tests/DelegatingEngineTest.php | 10 +- .../TranslationDataCollectorTest.php | 4 +- .../Tests/MessageCatalogueTest.php | 14 +-- .../Translation/Tests/TranslatorCacheTest.php | 6 +- .../Test/ConstraintValidatorTestCase.php | 6 +- .../Constraints/ExpressionValidatorTest.php | 4 +- .../Tests/Constraints/FileValidatorTest.php | 16 +-- ...ontainerConstraintValidatorFactoryTest.php | 2 +- .../Tests/Mapping/Cache/AbstractCacheTest.php | 6 +- .../LazyLoadingMetadataFactoryTest.php | 6 +- .../Tests/Mapping/Loader/LoaderChainTest.php | 8 +- .../Tests/Validator/AbstractTest.php | 4 +- .../Component/Workflow/Tests/RegistryTest.php | 4 +- 198 files changed, 1225 insertions(+), 1227 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 8cc2c0a05bd6..8523be670698 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -18,8 +18,6 @@ return PhpCsFixer\Config::create() 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'], // Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], - // Part of @Symfony:risky in PHP-CS-Fixer 2.15.0. Incompatible with PHPUnit 4 that is required for Symfony 3.4 - 'php_unit_mock_short_will_return' => false, ]) ->setRiskyAllowed(true) ->setFinder( diff --git a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php index 186610820c08..32b4aa730cad 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -166,20 +166,20 @@ private function createCollector($queries) ->getMock(); $connection->expects($this->any()) ->method('getDatabasePlatform') - ->will($this->returnValue(new MySqlPlatform())); + ->willReturn(new MySqlPlatform()); $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock(); $registry ->expects($this->any()) ->method('getConnectionNames') - ->will($this->returnValue(['default' => 'doctrine.dbal.default_connection'])); + ->willReturn(['default' => 'doctrine.dbal.default_connection']); $registry ->expects($this->any()) ->method('getManagerNames') - ->will($this->returnValue(['default' => 'doctrine.orm.default_entity_manager'])); + ->willReturn(['default' => 'doctrine.orm.default_entity_manager']); $registry->expects($this->any()) ->method('getConnection') - ->will($this->returnValue($connection)); + ->willReturn($connection); $logger = $this->getMockBuilder('Doctrine\DBAL\Logging\DebugStack')->getMock(); $logger->queries = $queries; diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php index 0f53d0952c14..fb9becd07294 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -44,9 +44,9 @@ protected function setUp() $this->extension->expects($this->any()) ->method('getObjectManagerElementName') - ->will($this->returnCallback(function ($name) { + ->willReturnCallback(function ($name) { return 'doctrine.orm.'.$name; - })); + }); } /** diff --git a/src/Symfony/Bridge/Doctrine/Tests/ExpressionLanguage/DoctrineParserCacheTest.php b/src/Symfony/Bridge/Doctrine/Tests/ExpressionLanguage/DoctrineParserCacheTest.php index 394b1b0dfe9a..e376f0a42236 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/ExpressionLanguage/DoctrineParserCacheTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/ExpressionLanguage/DoctrineParserCacheTest.php @@ -26,7 +26,7 @@ public function testFetch() $doctrineCacheMock->expects($this->once()) ->method('fetch') - ->will($this->returnValue('bar')); + ->willReturn('bar'); $result = $parserCache->fetch('foo'); @@ -41,7 +41,7 @@ public function testFetchUnexisting() $doctrineCacheMock ->expects($this->once()) ->method('fetch') - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertNull($parserCache->fetch('')); } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php index c323385ff192..d2e101b4cdc5 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php @@ -34,47 +34,47 @@ public function requiredProvider() // Simple field, not nullable $classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock(); $classMetadata->fieldMappings['field'] = true; - $classMetadata->expects($this->once())->method('isNullable')->with('field')->will($this->returnValue(false)); + $classMetadata->expects($this->once())->method('isNullable')->with('field')->willReturn(false); $return[] = [$classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE)]; // Simple field, nullable $classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock(); $classMetadata->fieldMappings['field'] = true; - $classMetadata->expects($this->once())->method('isNullable')->with('field')->will($this->returnValue(true)); + $classMetadata->expects($this->once())->method('isNullable')->with('field')->willReturn(true); $return[] = [$classMetadata, new ValueGuess(false, Guess::MEDIUM_CONFIDENCE)]; // One-to-one, nullable (by default) $classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock(); - $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true)); + $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true); $mapping = ['joinColumns' => [[]]]; - $classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping)); + $classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->willReturn($mapping); $return[] = [$classMetadata, new ValueGuess(false, Guess::HIGH_CONFIDENCE)]; // One-to-one, nullable (explicit) $classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock(); - $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true)); + $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true); $mapping = ['joinColumns' => [['nullable' => true]]]; - $classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping)); + $classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->willReturn($mapping); $return[] = [$classMetadata, new ValueGuess(false, Guess::HIGH_CONFIDENCE)]; // One-to-one, not nullable $classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock(); - $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(true)); + $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(true); $mapping = ['joinColumns' => [['nullable' => false]]]; - $classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->will($this->returnValue($mapping)); + $classMetadata->expects($this->once())->method('getAssociationMapping')->with('field')->willReturn($mapping); $return[] = [$classMetadata, new ValueGuess(true, Guess::HIGH_CONFIDENCE)]; // One-to-many, no clue $classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock(); - $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->will($this->returnValue(false)); + $classMetadata->expects($this->once())->method('isAssociationWithSingleJoinColumn')->with('field')->willReturn(false); $return[] = [$classMetadata, null]; @@ -84,10 +84,10 @@ public function requiredProvider() private function getGuesser(ClassMetadata $classMetadata) { $em = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')->getMock(); - $em->expects($this->once())->method('getClassMetaData')->with('TestEntity')->will($this->returnValue($classMetadata)); + $em->expects($this->once())->method('getClassMetaData')->with('TestEntity')->willReturn($classMetadata); $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry')->getMock(); - $registry->expects($this->once())->method('getManagers')->will($this->returnValue([$em])); + $registry->expects($this->once())->method('getManagers')->willReturn([$em]); return new DoctrineOrmTypeGuesser($registry); } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php index 5012171542f7..5dc184fb9100 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php @@ -38,11 +38,11 @@ protected function getExtensions() $manager->expects($this->any()) ->method('getManager') - ->will($this->returnValue($this->em)); + ->willReturn($this->em); $manager->expects($this->any()) ->method('getManagerForClass') - ->will($this->returnValue($this->em)); + ->willReturn($this->em); return [ new CoreExtension(), diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index 1cb59c38436e..7a806d76cd7f 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -1087,7 +1087,7 @@ public function testGetManagerForClassIfNoEm() $this->emRegistry->expects($this->once()) ->method('getManagerForClass') ->with(self::SINGLE_IDENT_CLASS) - ->will($this->returnValue($this->em)); + ->willReturn($this->em); $this->factory->createNamed('name', static::TESTED_TYPE, null, [ 'class' => self::SINGLE_IDENT_CLASS, @@ -1237,7 +1237,7 @@ protected function createRegistryMock($name, $em) $registry->expects($this->any()) ->method('getManager') ->with($this->equalTo($name)) - ->will($this->returnValue($em)); + ->willReturn($em); return $registry; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php index 7188a3abc1a7..e88a0a715c39 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php @@ -188,7 +188,7 @@ private function getManager($em, $name = null) $manager->expects($this->any()) ->method('getManager') ->with($this->equalTo($name)) - ->will($this->returnValue($em)); + ->willReturn($em); return $manager; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 60007eb8a3ba..24a7f555f4f6 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -82,7 +82,7 @@ protected function createRegistryMock(ObjectManager $em = null) $registry->expects($this->any()) ->method('getManager') ->with($this->equalTo(self::EM_NAME)) - ->will($this->returnValue($em)); + ->willReturn($em); return $registry; } @@ -104,14 +104,14 @@ protected function createEntityManagerMock($repositoryMock) ; $em->expects($this->any()) ->method('getRepository') - ->will($this->returnValue($repositoryMock)) + ->willReturn($repositoryMock) ; $classMetadata = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\ClassMetadata')->getMock(); $classMetadata ->expects($this->any()) ->method('hasField') - ->will($this->returnValue(true)) + ->willReturn(true) ; $reflParser = $this->getMockBuilder('Doctrine\Common\Reflection\StaticReflectionParser') ->disableOriginalConstructor() @@ -125,12 +125,12 @@ protected function createEntityManagerMock($repositoryMock) $refl ->expects($this->any()) ->method('getValue') - ->will($this->returnValue(true)) + ->willReturn(true) ; $classMetadata->reflFields = ['name' => $refl]; $em->expects($this->any()) ->method('getClassMetadata') - ->will($this->returnValue($classMetadata)) + ->willReturn($classMetadata) ; return $em; @@ -366,7 +366,7 @@ public function testValidateUniquenessUsingCustomRepositoryMethod() $repository = $this->createRepositoryMock(); $repository->expects($this->once()) ->method('findByCustom') - ->will($this->returnValue([])) + ->willReturn([]) ; $this->em = $this->createEntityManagerMock($repository); $this->registry = $this->createRegistryMock($this->em); @@ -394,15 +394,15 @@ public function testValidateUniquenessWithUnrewoundArray() $repository = $this->createRepositoryMock(); $repository->expects($this->once()) ->method('findByCustom') - ->will( - $this->returnCallback(function () use ($entity) { + ->willReturnCallback( + function () use ($entity) { $returnValue = [ $entity, ]; next($returnValue); return $returnValue; - }) + } ) ; $this->em = $this->createEntityManagerMock($repository); @@ -430,7 +430,7 @@ public function testValidateResultTypes($entity1, $result) $repository = $this->createRepositoryMock(); $repository->expects($this->once()) ->method('findByCustom') - ->will($this->returnValue($result)) + ->willReturn($result) ; $this->em = $this->createEntityManagerMock($repository); $this->registry = $this->createRegistryMock($this->em); @@ -564,7 +564,7 @@ public function testValidateUniquenessWithArrayValue() $repository->expects($this->once()) ->method('findByCustom') - ->will($this->returnValue([$entity1])) + ->willReturn([$entity1]) ; $this->em->persist($entity1); @@ -635,7 +635,7 @@ public function testValidateUniquenessOnNullResult() $repository = $this->createRepositoryMock(); $repository ->method('find') - ->will($this->returnValue(null)) + ->willReturn(null) ; $this->em = $this->createEntityManagerMock($repository); diff --git a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php index 0f042a90ae86..45a32dea84da 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php @@ -50,7 +50,7 @@ public function testVerbosityMapping($verbosity, $level, $isHandling, array $map $output ->expects($this->atLeastOnce()) ->method('getVerbosity') - ->will($this->returnValue($verbosity)) + ->willReturn($verbosity) ; $handler = new ConsoleHandler($output, true, $map); $this->assertSame($isHandling, $handler->isHandling(['level' => $level]), @@ -114,12 +114,12 @@ public function testVerbosityChanged() $output ->expects($this->at(0)) ->method('getVerbosity') - ->will($this->returnValue(OutputInterface::VERBOSITY_QUIET)) + ->willReturn(OutputInterface::VERBOSITY_QUIET) ; $output ->expects($this->at(1)) ->method('getVerbosity') - ->will($this->returnValue(OutputInterface::VERBOSITY_DEBUG)) + ->willReturn(OutputInterface::VERBOSITY_DEBUG) ; $handler = new ConsoleHandler($output); $this->assertFalse($handler->isHandling(['level' => Logger::NOTICE]), @@ -144,7 +144,7 @@ public function testWritingAndFormatting() $output ->expects($this->any()) ->method('getVerbosity') - ->will($this->returnValue(OutputInterface::VERBOSITY_DEBUG)) + ->willReturn(OutputInterface::VERBOSITY_DEBUG) ; $output ->expects($this->once()) diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/WebProcessorTest.php b/src/Symfony/Bridge/Monolog/Tests/Processor/WebProcessorTest.php index 4da83aa7d6d2..a69ab7562036 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Processor/WebProcessorTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/WebProcessorTest.php @@ -95,10 +95,10 @@ private function createRequestEvent($additionalServerParameters = []) ->getMock(); $event->expects($this->any()) ->method('isMasterRequest') - ->will($this->returnValue(true)); + ->willReturn(true); $event->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)); + ->willReturn($request); return [$event, $server]; } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php index 9fe36b40c906..22084ec1ae61 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php @@ -62,7 +62,7 @@ public function testUnknownFragmentRenderer() protected function getFragmentHandler($return) { $strategy = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface')->getMock(); - $strategy->expects($this->once())->method('getName')->will($this->returnValue('inline')); + $strategy->expects($this->once())->method('getName')->willReturn('inline'); $strategy->expects($this->once())->method('render')->will($return); $context = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack') @@ -70,7 +70,7 @@ protected function getFragmentHandler($return) ->getMock() ; - $context->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/'))); + $context->expects($this->any())->method('getCurrentRequest')->willReturn(Request::create('/')); return new FragmentHandler($context, [$strategy], false); } @@ -82,9 +82,9 @@ protected function renderTemplate(FragmentHandler $renderer, $template = '{{ ren $twig->addExtension(new HttpKernelExtension()); $loader = $this->getMockBuilder('Twig\RuntimeLoader\RuntimeLoaderInterface')->getMock(); - $loader->expects($this->any())->method('load')->will($this->returnValueMap([ + $loader->expects($this->any())->method('load')->willReturnMap([ ['Symfony\Bridge\Twig\Extension\HttpKernelRuntime', new HttpKernelRuntime($renderer)], - ])); + ]); $twig->addRuntimeLoader($loader); return $twig->render('index'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php index 94b5432c3ab9..c1b49c34f992 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php @@ -34,7 +34,7 @@ public function testFindAllTemplates() $kernel ->expects($this->once()) ->method('getBundles') - ->will($this->returnValue(['BaseBundle' => new BaseBundle()])) + ->willReturn(['BaseBundle' => new BaseBundle()]) ; $parser = new TemplateFilenameParser(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php index 30d024266372..b63c746eb60c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php @@ -68,13 +68,13 @@ public function testWarmUp() $this->templateFinder ->expects($this->once()) ->method('findAllTemplates') - ->will($this->returnValue([$template])); + ->willReturn([$template]); $this->fileLocator ->expects($this->once()) ->method('locate') ->with($template->getPath()) - ->will($this->returnValue(\dirname($this->tmpDir).'/path/to/template.html.twig')); + ->willReturn(\dirname($this->tmpDir).'/path/to/template.html.twig'); $warmer = new TemplatePathsCacheWarmer($this->templateFinder, $this->templateLocator); $warmer->warmUp($this->tmpDir); @@ -87,7 +87,7 @@ public function testWarmUpEmpty() $this->templateFinder ->expects($this->once()) ->method('findAllTemplates') - ->will($this->returnValue([])); + ->willReturn([]); $this->fileLocator ->expects($this->never()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php index 35a9e4ac0cb2..4790f271de3f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php @@ -82,7 +82,7 @@ private function getRouter() $router ->expects($this->any()) ->method('getRouteCollection') - ->will($this->returnValue($routeCollection)); + ->willReturn($routeCollection); return $router; } @@ -93,13 +93,13 @@ private function getKernel() $container ->expects($this->atLeastOnce()) ->method('has') - ->will($this->returnCallback(function ($id) { + ->willReturnCallback(function ($id) { if ('console.command_loader' === $id) { return false; } return true; - })) + }) ; $container ->expects($this->any()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php index a04ef46a90f3..e0bc2de0eb9f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php @@ -80,11 +80,11 @@ private function getRouter() $router ->expects($this->any()) ->method('getRouteCollection') - ->will($this->returnValue($routeCollection)); + ->willReturn($routeCollection); $router ->expects($this->any()) ->method('getContext') - ->will($this->returnValue($requestContext)); + ->willReturn($requestContext); return $router; } @@ -95,9 +95,9 @@ private function getKernel() $container ->expects($this->atLeastOnce()) ->method('has') - ->will($this->returnCallback(function ($id) { + ->willReturnCallback(function ($id) { return 'console.command_loader' !== $id; - })) + }) ; $container ->expects($this->any()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php index 622033e897d9..cfa6e3b8a877 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php @@ -136,26 +136,26 @@ private function createCommandTester($extractedMessages = [], $loadedMessages = $translator ->expects($this->any()) ->method('getFallbackLocales') - ->will($this->returnValue(['en'])); + ->willReturn(['en']); $extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock(); $extractor ->expects($this->any()) ->method('extract') - ->will( - $this->returnCallback(function ($path, $catalogue) use ($extractedMessages) { + ->willReturnCallback( + function ($path, $catalogue) use ($extractedMessages) { $catalogue->add($extractedMessages); - }) + } ); $loader = $this->getMockBuilder('Symfony\Component\Translation\Reader\TranslationReader')->getMock(); $loader ->expects($this->any()) ->method('read') - ->will( - $this->returnCallback(function ($path, $catalogue) use ($loadedMessages) { + ->willReturnCallback( + function ($path, $catalogue) use ($loadedMessages) { $catalogue->add($loadedMessages); - }) + } ); if (null === $kernel) { @@ -173,23 +173,23 @@ private function createCommandTester($extractedMessages = [], $loadedMessages = $kernel ->expects($this->any()) ->method('getBundle') - ->will($this->returnValueMap($returnValues)); + ->willReturnMap($returnValues); } $kernel ->expects($this->any()) ->method('getRootDir') - ->will($this->returnValue($this->translationDir)); + ->willReturn($this->translationDir); $kernel ->expects($this->any()) ->method('getBundles') - ->will($this->returnValue([])); + ->willReturn([]); $kernel ->expects($this->any()) ->method('getContainer') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock())); + ->willReturn($this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock()); $command = new TranslationDebugCommand($translator, $loader, $extractor, $this->translationDir.'/translations', $this->translationDir.'/templates'); @@ -214,23 +214,23 @@ public function testLegacyDebugCommand() $kernel ->expects($this->any()) ->method('getBundles') - ->will($this->returnValue([])); + ->willReturn([]); $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); $container ->expects($this->any()) ->method('get') - ->will($this->returnValueMap([ + ->willReturnMap([ ['translation.extractor', 1, $extractor], ['translation.reader', 1, $loader], ['translator', 1, $translator], ['kernel', 1, $kernel], - ])); + ]); $kernel ->expects($this->any()) ->method('getContainer') - ->will($this->returnValue($container)); + ->willReturn($container); $command = new TranslationDebugCommand(); $command->setContainer($container); @@ -250,7 +250,7 @@ private function getBundle($path) $bundle ->expects($this->any()) ->method('getPath') - ->will($this->returnValue($path)) + ->willReturn($path) ; return $bundle; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php index 87bc6c09e2eb..7e487ff52711 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php @@ -114,36 +114,36 @@ private function createCommandTester($extractedMessages = [], $loadedMessages = $translator ->expects($this->any()) ->method('getFallbackLocales') - ->will($this->returnValue(['en'])); + ->willReturn(['en']); $extractor = $this->getMockBuilder('Symfony\Component\Translation\Extractor\ExtractorInterface')->getMock(); $extractor ->expects($this->any()) ->method('extract') - ->will( - $this->returnCallback(function ($path, $catalogue) use ($extractedMessages) { + ->willReturnCallback( + function ($path, $catalogue) use ($extractedMessages) { foreach ($extractedMessages as $domain => $messages) { $catalogue->add($messages, $domain); } - }) + } ); $loader = $this->getMockBuilder('Symfony\Component\Translation\Reader\TranslationReader')->getMock(); $loader ->expects($this->any()) ->method('read') - ->will( - $this->returnCallback(function ($path, $catalogue) use ($loadedMessages) { + ->willReturnCallback( + function ($path, $catalogue) use ($loadedMessages) { $catalogue->add($loadedMessages); - }) + } ); $writer = $this->getMockBuilder('Symfony\Component\Translation\Writer\TranslationWriter')->getMock(); $writer ->expects($this->any()) ->method('getFormats') - ->will( - $this->returnValue(['xlf', 'yml', 'yaml']) + ->willReturn( + ['xlf', 'yml', 'yaml'] ); if (null === $kernel) { @@ -161,23 +161,23 @@ private function createCommandTester($extractedMessages = [], $loadedMessages = $kernel ->expects($this->any()) ->method('getBundle') - ->will($this->returnValueMap($returnValues)); + ->willReturnMap($returnValues); } $kernel ->expects($this->any()) ->method('getRootDir') - ->will($this->returnValue($this->translationDir)); + ->willReturn($this->translationDir); $kernel ->expects($this->any()) ->method('getBundles') - ->will($this->returnValue([])); + ->willReturn([]); $kernel ->expects($this->any()) ->method('getContainer') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock())); + ->willReturn($this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock()); $command = new TranslationUpdateCommand($writer, $loader, $extractor, 'en', $this->translationDir.'/translations', $this->translationDir.'/templates'); @@ -203,24 +203,24 @@ public function testLegacyUpdateCommand() $kernel ->expects($this->any()) ->method('getBundles') - ->will($this->returnValue([])); + ->willReturn([]); $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); $container ->expects($this->any()) ->method('get') - ->will($this->returnValueMap([ + ->willReturnMap([ ['translation.extractor', 1, $extractor], ['translation.reader', 1, $loader], ['translation.writer', 1, $writer], ['translator', 1, $translator], ['kernel', 1, $kernel], - ])); + ]); $kernel ->expects($this->any()) ->method('getContainer') - ->will($this->returnValue($container)); + ->willReturn($container); $command = new TranslationUpdateCommand(); $command->setContainer($container); @@ -240,7 +240,7 @@ private function getBundle($path) $bundle ->expects($this->any()) ->method('getPath') - ->will($this->returnValue($path)) + ->willReturn($path) ; return $bundle; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php index 8c25ef9672f4..fbc5a7733931 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php @@ -206,7 +206,7 @@ private function getKernel(array $bundles, $useDispatcher = false) ->expects($this->atLeastOnce()) ->method('get') ->with($this->equalTo('event_dispatcher')) - ->will($this->returnValue($dispatcher)); + ->willReturn($dispatcher); } $container @@ -226,12 +226,12 @@ private function getKernel(array $bundles, $useDispatcher = false) $kernel ->expects($this->any()) ->method('getBundles') - ->will($this->returnValue($bundles)) + ->willReturn($bundles) ; $kernel ->expects($this->any()) ->method('getContainer') - ->will($this->returnValue($container)) + ->willReturn($container) ; return $kernel; @@ -243,9 +243,9 @@ private function createBundleMock(array $commands) $bundle ->expects($this->once()) ->method('registerCommands') - ->will($this->returnCallback(function (Application $application) use ($commands) { + ->willReturnCallback(function (Application $application) use ($commands) { $application->addCommands($commands); - })) + }) ; return $bundle; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php index 66729f5fa4ea..91a72821e953 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php @@ -156,13 +156,13 @@ private function createParser() $kernel ->expects($this->any()) ->method('getBundle') - ->will($this->returnCallback(function ($bundle) use ($bundles) { + ->willReturnCallback(function ($bundle) use ($bundles) { if (!isset($bundles[$bundle])) { throw new \InvalidArgumentException(sprintf('Invalid bundle name "%s"', $bundle)); } return $bundles[$bundle]; - })) + }) ; $bundles = [ @@ -175,7 +175,7 @@ private function createParser() $kernel ->expects($this->any()) ->method('getBundles') - ->will($this->returnValue($bundles)) + ->willReturn($bundles) ; return new ControllerNameParser($kernel); @@ -184,8 +184,8 @@ private function createParser() private function getBundle($namespace, $name) { $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock(); - $bundle->expects($this->any())->method('getName')->will($this->returnValue($name)); - $bundle->expects($this->any())->method('getNamespace')->will($this->returnValue($namespace)); + $bundle->expects($this->any())->method('getName')->willReturn($name); + $bundle->expects($this->any())->method('getNamespace')->willReturn($namespace); return $bundle; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php index 93ce1527ba23..6af19862e6e8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php @@ -55,7 +55,7 @@ public function testGetControllerWithBundleNotation() $parser->expects($this->once()) ->method('parse') ->with($shortName) - ->will($this->returnValue('Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController::testAction')) + ->willReturn('Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController::testAction') ; $resolver = $this->createControllerResolver(null, null, $parser); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php index e72c558b7edc..da950ce0c804 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php @@ -43,9 +43,9 @@ public function testForward() $requestStack->push($request); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { + $kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) { return new Response($request->getRequestFormat().'--'.$request->getLocale()); - })); + }); $container = new Container(); $container->set('request_stack', $requestStack); @@ -110,7 +110,7 @@ private function getContainerWithTokenStorage($token = null) $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue($token)); + ->willReturn($token); $container = new Container(); $container->set('security.token_storage', $tokenStorage); @@ -137,7 +137,7 @@ public function testJsonWithSerializer() ->expects($this->once()) ->method('serialize') ->with([], 'json', ['json_encode_options' => JsonResponse::DEFAULT_ENCODING_OPTIONS]) - ->will($this->returnValue('[]')); + ->willReturn('[]'); $container->set('serializer', $serializer); @@ -158,7 +158,7 @@ public function testJsonWithSerializerContextOverride() ->expects($this->once()) ->method('serialize') ->with([], 'json', ['json_encode_options' => 0, 'other' => 'context']) - ->will($this->returnValue('[]')); + ->willReturn('[]'); $container->set('serializer', $serializer); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php index 076912d6e2d6..4bd0212e6953 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php @@ -72,7 +72,7 @@ public function testRoute($permanent, $ignoreAttributes, $expectedCode, $expecte ->expects($this->once()) ->method('generate') ->with($this->equalTo($route), $this->equalTo($expectedAttributes)) - ->will($this->returnValue($url)); + ->willReturn($url); $controller = new RedirectController($router); @@ -250,23 +250,23 @@ private function createRequestObject($scheme, $host, $port, $baseUrl, $queryStri $request ->expects($this->any()) ->method('getScheme') - ->will($this->returnValue($scheme)); + ->willReturn($scheme); $request ->expects($this->any()) ->method('getHost') - ->will($this->returnValue($host)); + ->willReturn($host); $request ->expects($this->any()) ->method('getPort') - ->will($this->returnValue($port)); + ->willReturn($port); $request ->expects($this->any()) ->method('getBaseUrl') - ->will($this->returnValue($baseUrl)); + ->willReturn($baseUrl); $request ->expects($this->any()) ->method('getQueryString') - ->will($this->returnValue($queryString)); + ->willReturn($queryString); return $request; } @@ -288,24 +288,24 @@ private function createLegacyRedirectController($httpPort = null, $httpsPort = n ->expects($this->once()) ->method('hasParameter') ->with($this->equalTo('request_listener.http_port')) - ->will($this->returnValue(true)); + ->willReturn(true); $container ->expects($this->once()) ->method('getParameter') ->with($this->equalTo('request_listener.http_port')) - ->will($this->returnValue($httpPort)); + ->willReturn($httpPort); } if (null !== $httpsPort) { $container ->expects($this->once()) ->method('hasParameter') ->with($this->equalTo('request_listener.https_port')) - ->will($this->returnValue(true)); + ->willReturn(true); $container ->expects($this->once()) ->method('getParameter') ->with($this->equalTo('request_listener.https_port')) - ->will($this->returnValue($httpsPort)); + ->willReturn($httpsPort); } $controller = new RedirectController(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php index 497c112eedb5..9dba1c05a2bc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php @@ -49,9 +49,9 @@ public function testLegacyTwig() $twig->expects($this->once())->method('render')->willReturn('bar'); $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); - $container->expects($this->at(0))->method('has')->will($this->returnValue(false)); - $container->expects($this->at(1))->method('has')->will($this->returnValue(true)); - $container->expects($this->at(2))->method('get')->will($this->returnValue($twig)); + $container->expects($this->at(0))->method('has')->willReturn(false); + $container->expects($this->at(1))->method('has')->willReturn(true); + $container->expects($this->at(2))->method('get')->willReturn($twig); $controller = new TemplateController(); $controller->setContainer($container); @@ -69,7 +69,7 @@ public function testLegacyTemplating() $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); $container->expects($this->at(0))->method('has')->willReturn(true); - $container->expects($this->at(1))->method('get')->will($this->returnValue($templating)); + $container->expects($this->at(1))->method('get')->willReturn($templating); $controller = new TemplateController(); $controller->setContainer($container); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php index 830909080975..9fe45527cffe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php @@ -248,7 +248,7 @@ private function getServiceContainer(RouteCollection $routes) $loader ->expects($this->any()) ->method('load') - ->will($this->returnValue($routes)) + ->willReturn($routes) ; $sc = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')->setMethods(['get'])->getMock(); @@ -256,7 +256,7 @@ private function getServiceContainer(RouteCollection $routes) $sc ->expects($this->once()) ->method('get') - ->will($this->returnValue($loader)) + ->willReturn($loader) ; return $sc; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php index 73983e47ce36..1fae0526d5d1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php @@ -67,7 +67,7 @@ public function testRenderResponseWithFrameworkEngine() $engine->expects($this->once()) ->method('renderResponse') ->with('template.php', ['foo' => 'bar']) - ->will($this->returnValue($response)); + ->willReturn($response); $container = $this->getContainerMock(['engine' => $engine]); $delegatingEngine = new DelegatingEngine($container, ['engine']); @@ -91,7 +91,7 @@ private function getEngineMock($template, $supports) $engine->expects($this->once()) ->method('supports') ->with($template) - ->will($this->returnValue($supports)); + ->willReturn($supports); return $engine; } @@ -103,7 +103,7 @@ private function getFrameworkEngineMock($template, $supports) $engine->expects($this->once()) ->method('supports') ->with($template) - ->will($this->returnValue($supports)); + ->willReturn($supports); return $engine; } @@ -117,7 +117,7 @@ private function getContainerMock($services) $container->expects($this->at($i++)) ->method('get') ->with($id) - ->will($this->returnValue($service)); + ->willReturn($service); } return $container; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php index d6c6b299ebc6..46a581b9442e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php @@ -47,7 +47,7 @@ public function testGetToken() $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue('token')); + ->willReturn('token'); $this->assertSame('token', $this->globals->getToken()); } @@ -77,12 +77,12 @@ public function testGetUser($user, $expectedUser) $token ->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue($token)); + ->willReturn($token); $this->assertSame($expectedUser, $this->globals->getUser()); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php index 3317b15d9091..c78b7e5b2910 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php @@ -27,7 +27,7 @@ public function testLocateATemplate() ->expects($this->once()) ->method('locate') ->with($template->getPath()) - ->will($this->returnValue('/path/to/template')) + ->willReturn('/path/to/template') ; $locator = new TemplateLocator($fileLocator); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php index 85e4917548db..4460d2ac2b52 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php @@ -26,13 +26,13 @@ protected function setUp() $kernel ->expects($this->any()) ->method('getBundle') - ->will($this->returnCallback(function ($bundle) { + ->willReturnCallback(function ($bundle) { if (\in_array($bundle, ['SensioFooBundle', 'SensioCmsFooBundle', 'FooBundle'])) { return true; } throw new \InvalidArgumentException(); - })) + }) ; $this->parser = new TemplateNameParser($kernel); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php index bd02809dc017..f3684529f24c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php @@ -31,7 +31,7 @@ public function testThatRenderLogsTime() $stopwatch->expects($this->once()) ->method('start') ->with('template.php (index.php)', 'template') - ->will($this->returnValue($stopwatchEvent)); + ->willReturn($stopwatchEvent); $stopwatchEvent->expects($this->once())->method('stop'); @@ -56,7 +56,7 @@ private function getTemplateNameParser() $templateNameParser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock(); $templateNameParser->expects($this->any()) ->method('parse') - ->will($this->returnValue($templateReference)); + ->willReturn($templateReference); return $templateNameParser; } @@ -91,7 +91,7 @@ private function getLoader($storage) $loader = $this->getMockForAbstractClass('Symfony\Component\Templating\Loader\Loader'); $loader->expects($this->once()) ->method('load') - ->will($this->returnValue($storage)); + ->willReturn($storage); return $loader; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php index aff109368b23..9dfd861dbeac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php @@ -147,7 +147,7 @@ public function testGetDefaultLocaleOmittingLocale() ->expects($this->once()) ->method('getParameter') ->with('kernel.default_locale') - ->will($this->returnValue('en')) + ->willReturn('en') ; $translator = new Translator($container, new MessageFormatter()); @@ -357,53 +357,53 @@ protected function getLoader() $loader ->expects($this->at(0)) ->method('load') - ->will($this->returnValue($this->getCatalogue('fr', [ + ->willReturn($this->getCatalogue('fr', [ 'foo' => 'foo (FR)', - ]))) + ])) ; $loader ->expects($this->at(1)) ->method('load') - ->will($this->returnValue($this->getCatalogue('en', [ + ->willReturn($this->getCatalogue('en', [ 'foo' => 'foo (EN)', 'bar' => 'bar (EN)', 'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)', - ]))) + ])) ; $loader ->expects($this->at(2)) ->method('load') - ->will($this->returnValue($this->getCatalogue('es', [ + ->willReturn($this->getCatalogue('es', [ 'foobar' => 'foobar (ES)', - ]))) + ])) ; $loader ->expects($this->at(3)) ->method('load') - ->will($this->returnValue($this->getCatalogue('pt-PT', [ + ->willReturn($this->getCatalogue('pt-PT', [ 'foobarfoo' => 'foobarfoo (PT-PT)', - ]))) + ])) ; $loader ->expects($this->at(4)) ->method('load') - ->will($this->returnValue($this->getCatalogue('pt_BR', [ + ->willReturn($this->getCatalogue('pt_BR', [ 'other choice' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR)', - ]))) + ])) ; $loader ->expects($this->at(5)) ->method('load') - ->will($this->returnValue($this->getCatalogue('fr.UTF-8', [ + ->willReturn($this->getCatalogue('fr.UTF-8', [ 'foobarbaz' => 'foobarbaz (fr.UTF-8)', - ]))) + ])) ; $loader ->expects($this->at(6)) ->method('load') - ->will($this->returnValue($this->getCatalogue('sr@latin', [ + ->willReturn($this->getCatalogue('sr@latin', [ 'foobarbax' => 'foobarbax (sr@latin)', - ]))) + ])) ; return $loader; @@ -415,7 +415,7 @@ protected function getContainer($loader) $container ->expects($this->any()) ->method('get') - ->will($this->returnValue($loader)) + ->willReturn($loader) ; return $container; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php index 864bd3c3bab7..8afe604c3a46 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Validator/ConstraintValidatorFactoryTest.php @@ -68,7 +68,7 @@ public function testGetInstanceInvalidValidatorClass() $constraint ->expects($this->exactly(2)) ->method('validatedBy') - ->will($this->returnValue('Fully\\Qualified\\ConstraintValidator\\Class\\Name')); + ->willReturn('Fully\\Qualified\\ConstraintValidator\\Class\\Name'); $factory = new ConstraintValidatorFactory(new Container()); $factory->getInstance($constraint); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php index ca82e805c3cd..9eb9a0817770 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php @@ -132,17 +132,17 @@ protected function callFactory($id, $config, $userProviderId, $defaultEntryPoint $factory ->expects($this->once()) ->method('createAuthProvider') - ->will($this->returnValue('auth_provider')) + ->willReturn('auth_provider') ; $factory ->expects($this->atLeastOnce()) ->method('getListenerId') - ->will($this->returnValue('abstract_listener')) + ->willReturn('abstract_listener') ; $factory ->expects($this->any()) ->method('getKey') - ->will($this->returnValue('abstract_factory')) + ->willReturn('abstract_factory') ; $container = new ContainerBuilder(); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php index 1ca5015a49fc..ae740e1ab2f2 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php @@ -44,7 +44,7 @@ public function testForwardRequestToConfiguredController() }), $this->equalTo(HttpKernelInterface::SUB_REQUEST) ) - ->will($this->returnValue($response)); + ->willReturn($response); $controller = new PreviewErrorController($kernel, $logicalControllerName); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php index a73921a8c768..906a0bc10806 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php @@ -24,7 +24,7 @@ public function testGetSourceContext() $locator ->expects($this->once()) ->method('locate') - ->will($this->returnValue(__DIR__.'/../DependencyInjection/Fixtures/Resources/views/layout.html.twig')) + ->willReturn(__DIR__.'/../DependencyInjection/Fixtures/Resources/views/layout.html.twig') ; $loader = new FilesystemLoader($locator, $parser); $loader->addPath(__DIR__.'/../DependencyInjection/Fixtures/Resources/views', 'namespace'); @@ -44,7 +44,7 @@ public function testExists() $locator ->expects($this->once()) ->method('locate') - ->will($this->returnValue($template = __DIR__.'/../DependencyInjection/Fixtures/Resources/views/layout.html.twig')) + ->willReturn($template = __DIR__.'/../DependencyInjection/Fixtures/Resources/views/layout.html.twig') ; $loader = new FilesystemLoader($locator, $parser); @@ -61,7 +61,7 @@ public function testTwigErrorIfLocatorThrowsInvalid() ->expects($this->once()) ->method('parse') ->with('name.format.engine') - ->will($this->returnValue(new TemplateReference('', '', 'name', 'format', 'engine'))) + ->willReturn(new TemplateReference('', '', 'name', 'format', 'engine')) ; $locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock(); @@ -85,14 +85,14 @@ public function testTwigErrorIfLocatorReturnsFalse() ->expects($this->once()) ->method('parse') ->with('name.format.engine') - ->will($this->returnValue(new TemplateReference('', '', 'name', 'format', 'engine'))) + ->willReturn(new TemplateReference('', '', 'name', 'format', 'engine')) ; $locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock(); $locator ->expects($this->once()) ->method('locate') - ->will($this->returnValue(false)) + ->willReturn(false) ; $loader = new FilesystemLoader($locator, $parser); diff --git a/src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php b/src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php index 33a873dba88d..b9092af3ebd0 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php @@ -18,13 +18,13 @@ class TemplateIteratorTest extends TestCase public function testGetIterator() { $bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')->getMock(); - $bundle->expects($this->any())->method('getName')->will($this->returnValue('BarBundle')); - $bundle->expects($this->any())->method('getPath')->will($this->returnValue(__DIR__.'/Fixtures/templates/BarBundle')); + $bundle->expects($this->any())->method('getName')->willReturn('BarBundle'); + $bundle->expects($this->any())->method('getPath')->willReturn(__DIR__.'/Fixtures/templates/BarBundle'); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Kernel')->disableOriginalConstructor()->getMock(); - $kernel->expects($this->any())->method('getBundles')->will($this->returnValue([ + $kernel->expects($this->any())->method('getBundles')->willReturn([ $bundle, - ])); + ]); $iterator = new TemplateIterator($kernel, __DIR__.'/Fixtures/templates', [__DIR__.'/Fixtures/templates/Foo' => 'Foo'], __DIR__.'/DependencyInjection/Fixtures/templates'); $sorted = iterator_to_array($iterator); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php index a507d36cf08a..a1e23041f8aa 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php @@ -97,11 +97,11 @@ public function testReturns404onTokenNotFound($withCsp) $profiler ->expects($this->exactly(2)) ->method('loadProfile') - ->will($this->returnCallback(function ($token) { + ->willReturnCallback(function ($token) { if ('found' == $token) { return new Profile($token); } - })) + }) ; $controller = $this->createController($profiler, $twig, $withCsp); @@ -149,7 +149,7 @@ public function testSearchResult($withCsp) $profiler ->expects($this->once()) ->method('find') - ->will($this->returnValue($tokens)); + ->willReturn($tokens); $request = Request::create('/_profiler/empty/search/results', 'GET', [ 'limit' => 2, diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php index bbf96c3b2b34..acccc7cbfb6d 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php @@ -200,7 +200,7 @@ private function mockNonceGenerator($value) $generator->expects($this->any()) ->method('generate') - ->will($this->returnValue($value)); + ->willReturn($value); return $generator; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php index 1260886f8df1..f8255f3894de 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php @@ -244,7 +244,7 @@ public function testXDebugUrlHeader() ->expects($this->once()) ->method('generate') ->with('_profiler', ['token' => 'xxxxxxxx'], UrlGeneratorInterface::ABSOLUTE_URL) - ->will($this->returnValue('http://mydomain.com/_profiler/xxxxxxxx')) + ->willReturn('http://mydomain.com/_profiler/xxxxxxxx') ; $event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(), HttpKernelInterface::MASTER_REQUEST, $response); @@ -302,10 +302,10 @@ protected function getRequestMock($isXmlHttpRequest = false, $requestFormat = 'h $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->setMethods(['getSession', 'isXmlHttpRequest', 'getRequestFormat'])->disableOriginalConstructor()->getMock(); $request->expects($this->any()) ->method('isXmlHttpRequest') - ->will($this->returnValue($isXmlHttpRequest)); + ->willReturn($isXmlHttpRequest); $request->expects($this->any()) ->method('getRequestFormat') - ->will($this->returnValue($requestFormat)); + ->willReturn($requestFormat); $request->headers = new HeaderBag(); @@ -313,7 +313,7 @@ protected function getRequestMock($isXmlHttpRequest = false, $requestFormat = 'h $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')->disableOriginalConstructor()->getMock(); $request->expects($this->any()) ->method('getSession') - ->will($this->returnValue($session)); + ->willReturn($session); } return $request; @@ -324,7 +324,7 @@ protected function getTwigMock($render = 'WDT') $templating = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock(); $templating->expects($this->any()) ->method('render') - ->will($this->returnValue($render)); + ->willReturn($render); return $templating; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php index 18d4cc44b402..c6bc1cdba36e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php @@ -69,7 +69,7 @@ public function testGetNameValidTemplate() $this->profiler->expects($this->any()) ->method('has') ->withAnyParameters() - ->will($this->returnCallback([$this, 'profilerHasCallback'])); + ->willReturnCallback([$this, 'profilerHasCallback']); $this->assertEquals('FooBundle:Collector:foo.html.twig', $this->templateManager->getName(new ProfileDummy(), 'foo')); } @@ -83,7 +83,7 @@ public function testGetTemplates() $this->profiler->expects($this->any()) ->method('has') ->withAnyParameters() - ->will($this->returnCallback([$this, 'profileHasCollectorCallback'])); + ->willReturnCallback([$this, 'profileHasCollectorCallback']); $result = $this->templateManager->getTemplates(new ProfileDummy()); $this->assertArrayHasKey('foo', $result); @@ -124,14 +124,14 @@ protected function mockTwigEnvironment() $this->twigEnvironment->expects($this->any()) ->method('loadTemplate') - ->will($this->returnValue('loadedTemplate')); + ->willReturn('loadedTemplate'); if (interface_exists('Twig\Loader\SourceContextLoaderInterface')) { $loader = $this->getMockBuilder('Twig\Loader\SourceContextLoaderInterface')->getMock(); } else { $loader = $this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock(); } - $this->twigEnvironment->expects($this->any())->method('getLoader')->will($this->returnValue($loader)); + $this->twigEnvironment->expects($this->any())->method('getLoader')->willReturn($loader); return $this->twigEnvironment; } diff --git a/src/Symfony/Component/Asset/Tests/PathPackageTest.php b/src/Symfony/Component/Asset/Tests/PathPackageTest.php index c6edc8de61a7..d00cc76c2a94 100644 --- a/src/Symfony/Component/Asset/Tests/PathPackageTest.php +++ b/src/Symfony/Component/Asset/Tests/PathPackageTest.php @@ -89,7 +89,7 @@ public function testVersionStrategyGivesAbsoluteURL() private function getContext($basePath) { $context = $this->getMockBuilder('Symfony\Component\Asset\Context\ContextInterface')->getMock(); - $context->expects($this->any())->method('getBasePath')->will($this->returnValue($basePath)); + $context->expects($this->any())->method('getBasePath')->willReturn($basePath); return $context; } diff --git a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php index 9b71d45bf31d..a68c59a1249c 100644 --- a/src/Symfony/Component/Asset/Tests/UrlPackageTest.php +++ b/src/Symfony/Component/Asset/Tests/UrlPackageTest.php @@ -107,7 +107,7 @@ public function testWrongBaseUrl() private function getContext($secure) { $context = $this->getMockBuilder('Symfony\Component\Asset\Context\ContextInterface')->getMock(); - $context->expects($this->any())->method('isSecure')->will($this->returnValue($secure)); + $context->expects($this->any())->method('isSecure')->willReturn($secure); return $context; } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php index 010f68b973e3..3b42697fe138 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php @@ -80,7 +80,7 @@ private function getPruneableMock() $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(true)); + ->willReturn(true); return $pruneable; } @@ -97,7 +97,7 @@ private function getFailingPruneableMock() $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(false)); + ->willReturn(false); return $pruneable; } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php index d0a1e5daf77b..488127cc950a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php @@ -173,7 +173,7 @@ private function getPruneableMock() $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(true)); + ->willReturn(true); return $pruneable; } @@ -190,7 +190,7 @@ private function getFailingPruneableMock() $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(false)); + ->willReturn(false); return $pruneable; } diff --git a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php index e6f7c7cc6322..aa77887919b7 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php @@ -78,7 +78,7 @@ private function getPruneableMock() $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(true)); + ->willReturn(true); return $pruneable; } @@ -95,7 +95,7 @@ private function getFailingPruneableMock() $pruneable ->expects($this->atLeastOnce()) ->method('prune') - ->will($this->returnValue(false)); + ->willReturn(false); return $pruneable; } diff --git a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php index 6e2a6ba2229d..6556962d1f15 100644 --- a/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php @@ -35,12 +35,12 @@ public function testGetSetResolver() public function testSupports() { $loader1 = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $loader1->expects($this->once())->method('supports')->will($this->returnValue(true)); + $loader1->expects($this->once())->method('supports')->willReturn(true); $loader = new DelegatingLoader(new LoaderResolver([$loader1])); $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); $loader1 = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $loader1->expects($this->once())->method('supports')->will($this->returnValue(false)); + $loader1->expects($this->once())->method('supports')->willReturn(false); $loader = new DelegatingLoader(new LoaderResolver([$loader1])); $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); } @@ -48,7 +48,7 @@ public function testSupports() public function testLoad() { $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $loader->expects($this->once())->method('supports')->will($this->returnValue(true)); + $loader->expects($this->once())->method('supports')->willReturn(true); $loader->expects($this->once())->method('load'); $resolver = new LoaderResolver([$loader]); $loader = new DelegatingLoader($resolver); @@ -62,7 +62,7 @@ public function testLoad() public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded() { $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $loader->expects($this->once())->method('supports')->will($this->returnValue(false)); + $loader->expects($this->once())->method('supports')->willReturn(false); $resolver = new LoaderResolver([$loader]); $loader = new DelegatingLoader($resolver); diff --git a/src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php b/src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php index 487dc43adc31..aabc2a600d8d 100644 --- a/src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php @@ -32,7 +32,7 @@ public function testResolve() $this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource'); $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); - $loader->expects($this->once())->method('supports')->will($this->returnValue(true)); + $loader->expects($this->once())->method('supports')->willReturn(true); $resolver = new LoaderResolver([$loader]); $this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource'); } diff --git a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php index 30167e3836f8..0c6e3fc025d1 100644 --- a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php @@ -34,7 +34,7 @@ public function testResolve() $resolver->expects($this->once()) ->method('resolve') ->with('foo.xml') - ->will($this->returnValue($resolvedLoader)); + ->willReturn($resolvedLoader); $loader = new ProjectLoader1(); $loader->setResolver($resolver); @@ -52,7 +52,7 @@ public function testResolveWhenResolverCannotFindLoader() $resolver->expects($this->once()) ->method('resolve') ->with('FOOBAR') - ->will($this->returnValue(false)); + ->willReturn(false); $loader = new ProjectLoader1(); $loader->setResolver($resolver); @@ -66,13 +66,13 @@ public function testImport() $resolvedLoader->expects($this->once()) ->method('load') ->with('foo') - ->will($this->returnValue('yes')); + ->willReturn('yes'); $resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock(); $resolver->expects($this->once()) ->method('resolve') ->with('foo') - ->will($this->returnValue($resolvedLoader)); + ->willReturn($resolvedLoader); $loader = new ProjectLoader1(); $loader->setResolver($resolver); @@ -86,13 +86,13 @@ public function testImportWithType() $resolvedLoader->expects($this->once()) ->method('load') ->with('foo', 'bar') - ->will($this->returnValue('yes')); + ->willReturn('yes'); $resolver = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderResolverInterface')->getMock(); $resolver->expects($this->once()) ->method('resolve') ->with('foo', 'bar') - ->will($this->returnValue($resolvedLoader)); + ->willReturn($resolvedLoader); $loader = new ProjectLoader1(); $loader->setResolver($resolver); diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index b920d211aaa8..181e82593db7 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -660,7 +660,7 @@ public function testFindNamespaceDoesNotFailOnDeepSimilarNamespaces() $application = $this->getMockBuilder('Symfony\Component\Console\Application')->setMethods(['getNamespaces'])->getMock(); $application->expects($this->once()) ->method('getNamespaces') - ->will($this->returnValue(['foo:sublong', 'bar:sub'])); + ->willReturn(['foo:sublong', 'bar:sub']); $this->assertEquals('foo:sublong', $application->findNamespace('f:sub')); } @@ -804,7 +804,7 @@ public function testRenderExceptionLineBreaks() $application->setAutoExit(false); $application->expects($this->any()) ->method('getTerminalWidth') - ->will($this->returnValue(120)); + ->willReturn(120); $application->register('foo')->setCode(function () { throw new \InvalidArgumentException("\n\nline 1 with extra spaces \nline 2\n\nline 4\n"); }); diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index b3ce402209a8..9a135d325590 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -321,7 +321,7 @@ public function testRunReturnsIntegerExitCode() $command = $this->getMockBuilder('TestCommand')->setMethods(['execute'])->getMock(); $command->expects($this->once()) ->method('execute') - ->will($this->returnValue('2.3')); + ->willReturn('2.3'); $exitCode = $command->run(new StringInput(''), new NullOutput()); $this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)'); } diff --git a/src/Symfony/Component/Console/Tests/Helper/AbstractQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/AbstractQuestionHelperTest.php index 56dd65f6b456..f12566dedd65 100644 --- a/src/Symfony/Component/Console/Tests/Helper/AbstractQuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/AbstractQuestionHelperTest.php @@ -21,7 +21,7 @@ protected function createStreamableInputInterfaceMock($stream = null, $interacti $mock = $this->getMockBuilder(StreamableInputInterface::class)->getMock(); $mock->expects($this->any()) ->method('isInteractive') - ->will($this->returnValue($interactive)); + ->willReturn($interactive); if ($stream) { $mock->expects($this->any()) diff --git a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php index 826bc51dcd62..ffb12b3421f9 100644 --- a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php @@ -114,7 +114,7 @@ private function getGenericMockHelper($name, HelperSet $helperset = null) $mock_helper = $this->getMockBuilder('\Symfony\Component\Console\Helper\HelperInterface')->getMock(); $mock_helper->expects($this->any()) ->method('getName') - ->will($this->returnValue($name)); + ->willReturn($name); if ($helperset) { $mock_helper->expects($this->any()) diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index 3c030e04983d..53819e4be70e 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -1068,7 +1068,7 @@ protected function createInputInterfaceMock($interactive = true) $mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $mock->expects($this->any()) ->method('isInteractive') - ->will($this->returnValue($interactive)); + ->willReturn($interactive); return $mock; } diff --git a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php index cf7a78c34ecd..6f621db95448 100644 --- a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php @@ -154,7 +154,7 @@ protected function createInputInterfaceMock($interactive = true) $mock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $mock->expects($this->any()) ->method('isInteractive') - ->will($this->returnValue($interactive)); + ->willReturn($interactive); return $mock; } diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php index efeec4234e95..c99eb839b7f3 100644 --- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php +++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php @@ -166,7 +166,7 @@ public function testObjectCastToString() } else { $dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']); } - $dummy->method('__toString')->will($this->returnValue('DUMMY')); + $dummy->method('__toString')->willReturn('DUMMY'); $this->getLogger()->warning($dummy); diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index 15de37c7b780..bb82c63328b1 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -234,7 +234,7 @@ public function testHandleError() $logger ->expects($this->once()) ->method('log') - ->will($this->returnCallback($warnArgCheck)) + ->willReturnCallback($warnArgCheck) ; $handler = ErrorHandler::register(); @@ -262,7 +262,7 @@ public function testHandleError() $logger ->expects($this->once()) ->method('log') - ->will($this->returnCallback($logArgCheck)) + ->willReturnCallback($logArgCheck) ; $handler = ErrorHandler::register(); @@ -318,7 +318,7 @@ public function testHandleDeprecation() $logger ->expects($this->once()) ->method('log') - ->will($this->returnCallback($logArgCheck)) + ->willReturnCallback($logArgCheck) ; $handler = new ErrorHandler(); @@ -349,7 +349,7 @@ public function testHandleException() $logger ->expects($this->exactly(2)) ->method('log') - ->will($this->returnCallback($logArgCheck)) + ->willReturnCallback($logArgCheck) ; $handler->setDefaultLogger($logger, E_ERROR); @@ -503,7 +503,7 @@ public function testHandleFatalError() $logger ->expects($this->once()) ->method('log') - ->will($this->returnCallback($logArgCheck)) + ->willReturnCallback($logArgCheck) ; $handler->setDefaultLogger($logger, E_PARSE); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php index 5bcb1234223a..c5ba149aebea 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowireExceptionPassTest.php @@ -31,13 +31,13 @@ public function testThrowsException() $autowireException = new AutowiringFailedException('foo_service_id', 'An autowiring exception message'); $autowirePass->expects($this->any()) ->method('getAutowiringExceptions') - ->will($this->returnValue([$autowireException])); + ->willReturn([$autowireException]); $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) ->getMock(); $inlinePass->expects($this->any()) ->method('getInlinedServiceIds') - ->will($this->returnValue([])); + ->willReturn([]); $container = new ContainerBuilder(); $container->register('foo_service_id'); @@ -60,18 +60,18 @@ public function testThrowExceptionIfServiceInlined() $autowireException = new AutowiringFailedException('a_service', 'An autowiring exception message'); $autowirePass->expects($this->any()) ->method('getAutowiringExceptions') - ->will($this->returnValue([$autowireException])); + ->willReturn([$autowireException]); $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) ->getMock(); $inlinePass->expects($this->any()) ->method('getInlinedServiceIds') - ->will($this->returnValue([ + ->willReturn([ // a_service inlined into b_service 'a_service' => ['b_service'], // b_service inlined into c_service 'b_service' => ['c_service'], - ])); + ]); $container = new ContainerBuilder(); // ONLY register c_service in the final container @@ -95,18 +95,18 @@ public function testDoNotThrowExceptionIfServiceInlinedButRemoved() $autowireException = new AutowiringFailedException('a_service', 'An autowiring exception message'); $autowirePass->expects($this->any()) ->method('getAutowiringExceptions') - ->will($this->returnValue([$autowireException])); + ->willReturn([$autowireException]); $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) ->getMock(); $inlinePass->expects($this->any()) ->method('getInlinedServiceIds') - ->will($this->returnValue([ + ->willReturn([ // a_service inlined into b_service 'a_service' => ['b_service'], // b_service inlined into c_service 'b_service' => ['c_service'], - ])); + ]); // do NOT register c_service in the container $container = new ContainerBuilder(); @@ -126,13 +126,13 @@ public function testNoExceptionIfServiceRemoved() $autowireException = new AutowiringFailedException('non_existent_service'); $autowirePass->expects($this->any()) ->method('getAutowiringExceptions') - ->will($this->returnValue([$autowireException])); + ->willReturn([$autowireException]); $inlinePass = $this->getMockBuilder(InlineServiceDefinitionsPass::class) ->getMock(); $inlinePass->expects($this->any()) ->method('getInlinedServiceIds') - ->will($this->returnValue([])); + ->willReturn([]); $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index 667ae388648a..1bef795f2b52 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -30,18 +30,18 @@ public function testExpressionLanguageProviderForwarding() $extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock(); $extension->expects($this->any()) ->method('getXsdValidationBasePath') - ->will($this->returnValue(false)); + ->willReturn(false); $extension->expects($this->any()) ->method('getNamespace') - ->will($this->returnValue('http://example.org/schema/dic/foo')); + ->willReturn('http://example.org/schema/dic/foo'); $extension->expects($this->any()) ->method('getAlias') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $extension->expects($this->once()) ->method('load') - ->will($this->returnCallback(function (array $config, ContainerBuilder $container) use (&$tmpProviders) { + ->willReturnCallback(function (array $config, ContainerBuilder $container) use (&$tmpProviders) { $tmpProviders = $container->getExpressionLanguageProviders(); - })); + }); $provider = $this->getMockBuilder('Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface')->getMock(); $container = new ContainerBuilder(new ParameterBag()); @@ -76,7 +76,7 @@ public function testExtensionConfigurationIsTrackedByDefault() $extension = $this->getMockBuilder(FooExtension::class)->setMethods(['getConfiguration'])->getMock(); $extension->expects($this->exactly(2)) ->method('getConfiguration') - ->will($this->returnValue(new FooConfiguration())); + ->willReturn(new FooConfiguration()); $container = new ContainerBuilder(new ParameterBag()); $container->registerExtension($extension); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php index fc2d85ecf956..eb5fc5a99d2e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php @@ -67,10 +67,10 @@ public function isFreshProvider() [$this->equalTo('locales')], [$this->equalTo('default_locale')] ) - ->will($this->returnValueMap([ + ->willReturnMap([ ['locales', ['fr', 'en']], ['default_locale', 'fr'], - ])) + ]) ; }, true]; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 73cb670cdb12..b3bea30b749b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1059,7 +1059,7 @@ public function testExtension() public function testRegisteredButNotLoadedExtension() { $extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock(); - $extension->expects($this->once())->method('getAlias')->will($this->returnValue('project')); + $extension->expects($this->once())->method('getAlias')->willReturn('project'); $extension->expects($this->never())->method('load'); $container = new ContainerBuilder(); @@ -1071,7 +1071,7 @@ public function testRegisteredButNotLoadedExtension() public function testRegisteredAndLoadedExtension() { $extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface')->getMock(); - $extension->expects($this->exactly(2))->method('getAlias')->will($this->returnValue('project')); + $extension->expects($this->exactly(2))->method('getAlias')->willReturn('project'); $extension->expects($this->once())->method('load')->with([['foo' => 'bar']]); $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php index 2778fd075e3a..2c0ee22c1fc4 100644 --- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php @@ -862,13 +862,13 @@ protected function getFormFieldMock($name, $value = null) $field ->expects($this->any()) ->method('getName') - ->will($this->returnValue($name)) + ->willReturn($name) ; $field ->expects($this->any()) ->method('getValue') - ->will($this->returnValue($value)) + ->willReturn($value) ; return $field; diff --git a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php index 04f2861e3319..c52fefe509ae 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php @@ -43,7 +43,7 @@ public function testDispatchDelegates() $this->innerDispatcher->expects($this->once()) ->method('dispatch') ->with('event', $event) - ->will($this->returnValue('result')); + ->willReturn('result'); $this->assertSame('result', $this->dispatcher->dispatch('event', $event)); } @@ -53,7 +53,7 @@ public function testGetListenersDelegates() $this->innerDispatcher->expects($this->once()) ->method('getListeners') ->with('event') - ->will($this->returnValue('result')); + ->willReturn('result'); $this->assertSame('result', $this->dispatcher->getListeners('event')); } @@ -63,7 +63,7 @@ public function testHasListenersDelegates() $this->innerDispatcher->expects($this->once()) ->method('hasListeners') ->with('event') - ->will($this->returnValue('result')); + ->willReturn('result'); $this->assertSame('result', $this->dispatcher->hasListeners('event')); } diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index d2a660286da1..83b608b2b995 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -36,18 +36,18 @@ public function testCachedParse() $cacheItemMock ->expects($this->exactly(2)) ->method('get') - ->will($this->returnCallback(function () use (&$savedParsedExpression) { + ->willReturnCallback(function () use (&$savedParsedExpression) { return $savedParsedExpression; - })) + }) ; $cacheItemMock ->expects($this->exactly(1)) ->method('set') ->with($this->isInstanceOf(ParsedExpression::class)) - ->will($this->returnCallback(function ($parsedExpression) use (&$savedParsedExpression) { + ->willReturnCallback(function ($parsedExpression) use (&$savedParsedExpression) { $savedParsedExpression = $parsedExpression; - })) + }) ; $cacheMock @@ -85,9 +85,9 @@ public function testCachedParseWithDeprecatedParserCacheInterface() ->expects($this->exactly(1)) ->method('save') ->with('1%20%2B%201%2F%2F', $this->isInstanceOf(ParsedExpression::class)) - ->will($this->returnCallback(function ($key, $expression) use (&$savedParsedExpression) { + ->willReturnCallback(function ($key, $expression) use (&$savedParsedExpression) { $savedParsedExpression = $expression; - })) + }) ; $parsedExpression = $expressionLanguage->parse('1 + 1', []); @@ -213,18 +213,18 @@ public function testCachingWithDifferentNamesOrder() $cacheItemMock ->expects($this->exactly(2)) ->method('get') - ->will($this->returnCallback(function () use (&$savedParsedExpression) { + ->willReturnCallback(function () use (&$savedParsedExpression) { return $savedParsedExpression; - })) + }) ; $cacheItemMock ->expects($this->exactly(1)) ->method('set') ->with($this->isInstanceOf(ParsedExpression::class)) - ->will($this->returnCallback(function ($parsedExpression) use (&$savedParsedExpression) { + ->willReturnCallback(function ($parsedExpression) use (&$savedParsedExpression) { $savedParsedExpression = $parsedExpression; - })) + }) ; $cacheMock diff --git a/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php index b26f7ba6bdd2..181b1464fcd9 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php @@ -26,9 +26,9 @@ public function testFilterFilesystemIterators() $i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', [$i]); $i->expects($this->any()) ->method('accept') - ->will($this->returnCallback(function () use ($i) { + ->willReturnCallback(function () use ($i) { return (bool) preg_match('/\.php/', (string) $i->current()); - }) + } ); $c = 0; diff --git a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php index ab8444974959..fe0d3e6629b2 100644 --- a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php @@ -473,7 +473,7 @@ public function testCsrf() { $this->csrfTokenManager->expects($this->any()) ->method('getToken') - ->will($this->returnValue(new CsrfToken('token_id', 'foo&bar'))); + ->willReturn(new CsrfToken('token_id', 'foo&bar')); $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType') ->add($this->factory diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php index b470769344bb..f2ee71b3424c 100644 --- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php @@ -312,10 +312,10 @@ public function testAddFormErrorIfPostMaxSizeExceeded($contentLength, $iniMax, $ { $this->serverParams->expects($this->once()) ->method('getContentLength') - ->will($this->returnValue($contentLength)); + ->willReturn($contentLength); $this->serverParams->expects($this->any()) ->method('getNormalizedIniPostMaxSize') - ->will($this->returnValue($iniMax)); + ->willReturn($iniMax); $options = ['post_max_size_message' => 'Max {{ max }}!']; $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, $options); diff --git a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php index 6c09ba8ead45..7cc68bd83d26 100644 --- a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php @@ -339,7 +339,7 @@ public function testCsrf() { $this->csrfTokenManager->expects($this->any()) ->method('getToken') - ->will($this->returnValue(new CsrfToken('token_id', 'foo&bar'))); + ->willReturn(new CsrfToken('token_id', 'foo&bar')); $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType') ->add($this->factory diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php index ca5b67c817f2..7277d49780d6 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php @@ -42,7 +42,7 @@ public function testCreateFromChoicesEmpty() $this->decoratedFactory->expects($this->once()) ->method('createListFromChoices') ->with([]) - ->will($this->returnValue($list)); + ->willReturn($list); $this->assertSame($list, $this->factory->createListFromChoices([])); $this->assertSame($list, $this->factory->createListFromChoices([])); @@ -58,7 +58,7 @@ public function testCreateFromChoicesComparesTraversableChoicesAsArray() $this->decoratedFactory->expects($this->once()) ->method('createListFromChoices') ->with($choices2) - ->will($this->returnValue($list)); + ->willReturn($list); $this->assertSame($list, $this->factory->createListFromChoices($choices1)); $this->assertSame($list, $this->factory->createListFromChoices($choices2)); @@ -74,11 +74,11 @@ public function testCreateFromChoicesGroupedChoices() $this->decoratedFactory->expects($this->at(0)) ->method('createListFromChoices') ->with($choices1) - ->will($this->returnValue($list1)); + ->willReturn($list1); $this->decoratedFactory->expects($this->at(1)) ->method('createListFromChoices') ->with($choices2) - ->will($this->returnValue($list2)); + ->willReturn($list2); $this->assertSame($list1, $this->factory->createListFromChoices($choices1)); $this->assertSame($list2, $this->factory->createListFromChoices($choices2)); @@ -96,7 +96,7 @@ public function testCreateFromChoicesSameChoices($choice1, $choice2) $this->decoratedFactory->expects($this->once()) ->method('createListFromChoices') ->with($choices1) - ->will($this->returnValue($list)); + ->willReturn($list); $this->assertSame($list, $this->factory->createListFromChoices($choices1)); $this->assertSame($list, $this->factory->createListFromChoices($choices2)); @@ -115,11 +115,11 @@ public function testCreateFromChoicesDifferentChoices($choice1, $choice2) $this->decoratedFactory->expects($this->at(0)) ->method('createListFromChoices') ->with($choices1) - ->will($this->returnValue($list1)); + ->willReturn($list1); $this->decoratedFactory->expects($this->at(1)) ->method('createListFromChoices') ->with($choices2) - ->will($this->returnValue($list2)); + ->willReturn($list2); $this->assertSame($list1, $this->factory->createListFromChoices($choices1)); $this->assertSame($list2, $this->factory->createListFromChoices($choices2)); @@ -134,7 +134,7 @@ public function testCreateFromChoicesSameValueClosure() $this->decoratedFactory->expects($this->once()) ->method('createListFromChoices') ->with($choices, $closure) - ->will($this->returnValue($list)); + ->willReturn($list); $this->assertSame($list, $this->factory->createListFromChoices($choices, $closure)); $this->assertSame($list, $this->factory->createListFromChoices($choices, $closure)); @@ -151,11 +151,11 @@ public function testCreateFromChoicesDifferentValueClosure() $this->decoratedFactory->expects($this->at(0)) ->method('createListFromChoices') ->with($choices, $closure1) - ->will($this->returnValue($list1)); + ->willReturn($list1); $this->decoratedFactory->expects($this->at(1)) ->method('createListFromChoices') ->with($choices, $closure2) - ->will($this->returnValue($list2)); + ->willReturn($list2); $this->assertSame($list1, $this->factory->createListFromChoices($choices, $closure1)); $this->assertSame($list2, $this->factory->createListFromChoices($choices, $closure2)); @@ -169,7 +169,7 @@ public function testCreateFromLoaderSameLoader() $this->decoratedFactory->expects($this->once()) ->method('createListFromLoader') ->with($loader) - ->will($this->returnValue($list)); + ->willReturn($list); $this->assertSame($list, $this->factory->createListFromLoader($loader)); $this->assertSame($list, $this->factory->createListFromLoader($loader)); @@ -185,11 +185,11 @@ public function testCreateFromLoaderDifferentLoader() $this->decoratedFactory->expects($this->at(0)) ->method('createListFromLoader') ->with($loader1) - ->will($this->returnValue($list1)); + ->willReturn($list1); $this->decoratedFactory->expects($this->at(1)) ->method('createListFromLoader') ->with($loader2) - ->will($this->returnValue($list2)); + ->willReturn($list2); $this->assertSame($list1, $this->factory->createListFromLoader($loader1)); $this->assertSame($list2, $this->factory->createListFromLoader($loader2)); @@ -204,7 +204,7 @@ public function testCreateFromLoaderSameValueClosure() $this->decoratedFactory->expects($this->once()) ->method('createListFromLoader') ->with($loader, $closure) - ->will($this->returnValue($list)); + ->willReturn($list); $this->assertSame($list, $this->factory->createListFromLoader($loader, $closure)); $this->assertSame($list, $this->factory->createListFromLoader($loader, $closure)); @@ -221,11 +221,11 @@ public function testCreateFromLoaderDifferentValueClosure() $this->decoratedFactory->expects($this->at(0)) ->method('createListFromLoader') ->with($loader, $closure1) - ->will($this->returnValue($list1)); + ->willReturn($list1); $this->decoratedFactory->expects($this->at(1)) ->method('createListFromLoader') ->with($loader, $closure2) - ->will($this->returnValue($list2)); + ->willReturn($list2); $this->assertSame($list1, $this->factory->createListFromLoader($loader, $closure1)); $this->assertSame($list2, $this->factory->createListFromLoader($loader, $closure2)); @@ -240,7 +240,7 @@ public function testCreateViewSamePreferredChoices() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, $preferred) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $this->factory->createView($list, $preferred)); $this->assertSame($view, $this->factory->createView($list, $preferred)); @@ -257,11 +257,11 @@ public function testCreateViewDifferentPreferredChoices() $this->decoratedFactory->expects($this->at(0)) ->method('createView') ->with($list, $preferred1) - ->will($this->returnValue($view1)); + ->willReturn($view1); $this->decoratedFactory->expects($this->at(1)) ->method('createView') ->with($list, $preferred2) - ->will($this->returnValue($view2)); + ->willReturn($view2); $this->assertSame($view1, $this->factory->createView($list, $preferred1)); $this->assertSame($view2, $this->factory->createView($list, $preferred2)); @@ -276,7 +276,7 @@ public function testCreateViewSamePreferredChoicesClosure() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, $preferred) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $this->factory->createView($list, $preferred)); $this->assertSame($view, $this->factory->createView($list, $preferred)); @@ -293,11 +293,11 @@ public function testCreateViewDifferentPreferredChoicesClosure() $this->decoratedFactory->expects($this->at(0)) ->method('createView') ->with($list, $preferred1) - ->will($this->returnValue($view1)); + ->willReturn($view1); $this->decoratedFactory->expects($this->at(1)) ->method('createView') ->with($list, $preferred2) - ->will($this->returnValue($view2)); + ->willReturn($view2); $this->assertSame($view1, $this->factory->createView($list, $preferred1)); $this->assertSame($view2, $this->factory->createView($list, $preferred2)); @@ -312,7 +312,7 @@ public function testCreateViewSameLabelClosure() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, $labels) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $this->factory->createView($list, null, $labels)); $this->assertSame($view, $this->factory->createView($list, null, $labels)); @@ -329,11 +329,11 @@ public function testCreateViewDifferentLabelClosure() $this->decoratedFactory->expects($this->at(0)) ->method('createView') ->with($list, null, $labels1) - ->will($this->returnValue($view1)); + ->willReturn($view1); $this->decoratedFactory->expects($this->at(1)) ->method('createView') ->with($list, null, $labels2) - ->will($this->returnValue($view2)); + ->willReturn($view2); $this->assertSame($view1, $this->factory->createView($list, null, $labels1)); $this->assertSame($view2, $this->factory->createView($list, null, $labels2)); @@ -348,7 +348,7 @@ public function testCreateViewSameIndexClosure() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, $index) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $this->factory->createView($list, null, null, $index)); $this->assertSame($view, $this->factory->createView($list, null, null, $index)); @@ -365,11 +365,11 @@ public function testCreateViewDifferentIndexClosure() $this->decoratedFactory->expects($this->at(0)) ->method('createView') ->with($list, null, null, $index1) - ->will($this->returnValue($view1)); + ->willReturn($view1); $this->decoratedFactory->expects($this->at(1)) ->method('createView') ->with($list, null, null, $index2) - ->will($this->returnValue($view2)); + ->willReturn($view2); $this->assertSame($view1, $this->factory->createView($list, null, null, $index1)); $this->assertSame($view2, $this->factory->createView($list, null, null, $index2)); @@ -384,7 +384,7 @@ public function testCreateViewSameGroupByClosure() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, null, $groupBy) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $this->factory->createView($list, null, null, null, $groupBy)); $this->assertSame($view, $this->factory->createView($list, null, null, null, $groupBy)); @@ -401,11 +401,11 @@ public function testCreateViewDifferentGroupByClosure() $this->decoratedFactory->expects($this->at(0)) ->method('createView') ->with($list, null, null, null, $groupBy1) - ->will($this->returnValue($view1)); + ->willReturn($view1); $this->decoratedFactory->expects($this->at(1)) ->method('createView') ->with($list, null, null, null, $groupBy2) - ->will($this->returnValue($view2)); + ->willReturn($view2); $this->assertSame($view1, $this->factory->createView($list, null, null, null, $groupBy1)); $this->assertSame($view2, $this->factory->createView($list, null, null, null, $groupBy2)); @@ -420,7 +420,7 @@ public function testCreateViewSameAttributes() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, null, null, $attr) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $this->factory->createView($list, null, null, null, null, $attr)); $this->assertSame($view, $this->factory->createView($list, null, null, null, null, $attr)); @@ -437,11 +437,11 @@ public function testCreateViewDifferentAttributes() $this->decoratedFactory->expects($this->at(0)) ->method('createView') ->with($list, null, null, null, null, $attr1) - ->will($this->returnValue($view1)); + ->willReturn($view1); $this->decoratedFactory->expects($this->at(1)) ->method('createView') ->with($list, null, null, null, null, $attr2) - ->will($this->returnValue($view2)); + ->willReturn($view2); $this->assertSame($view1, $this->factory->createView($list, null, null, null, null, $attr1)); $this->assertSame($view2, $this->factory->createView($list, null, null, null, null, $attr2)); @@ -456,7 +456,7 @@ public function testCreateViewSameAttributesClosure() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, null, null, $attr) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $this->factory->createView($list, null, null, null, null, $attr)); $this->assertSame($view, $this->factory->createView($list, null, null, null, null, $attr)); @@ -473,11 +473,11 @@ public function testCreateViewDifferentAttributesClosure() $this->decoratedFactory->expects($this->at(0)) ->method('createView') ->with($list, null, null, null, null, $attr1) - ->will($this->returnValue($view1)); + ->willReturn($view1); $this->decoratedFactory->expects($this->at(1)) ->method('createView') ->with($list, null, null, null, null, $attr2) - ->will($this->returnValue($view2)); + ->willReturn($view2); $this->assertSame($view1, $this->factory->createView($list, null, null, null, null, $attr1)); $this->assertSame($view2, $this->factory->createView($list, null, null, null, null, $attr2)); diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php index 1b943e81c1ec..42893696db62 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php @@ -43,9 +43,9 @@ public function testCreateFromChoicesPropertyPath() $this->decoratedFactory->expects($this->once()) ->method('createListFromChoices') ->with($choices, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($choices, $callback) { + ->willReturnCallback(function ($choices, $callback) { return array_map($callback, $choices); - })); + }); $this->assertSame(['value'], $this->factory->createListFromChoices($choices, 'property')); } @@ -57,9 +57,9 @@ public function testCreateFromChoicesPropertyPathInstance() $this->decoratedFactory->expects($this->once()) ->method('createListFromChoices') ->with($choices, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($choices, $callback) { + ->willReturnCallback(function ($choices, $callback) { return array_map($callback, $choices); - })); + }); $this->assertSame(['value'], $this->factory->createListFromChoices($choices, new PropertyPath('property'))); } @@ -86,9 +86,9 @@ public function testCreateFromLoaderPropertyPath() $this->decoratedFactory->expects($this->once()) ->method('createListFromLoader') ->with($loader, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($loader, $callback) { + ->willReturnCallback(function ($loader, $callback) { return $callback((object) ['property' => 'value']); - })); + }); $this->assertSame('value', $this->factory->createListFromLoader($loader, 'property')); } @@ -116,9 +116,9 @@ public function testCreateFromChoicesAssumeNullIfValuePropertyPathUnreadable() $this->decoratedFactory->expects($this->once()) ->method('createListFromChoices') ->with($choices, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($choices, $callback) { + ->willReturnCallback(function ($choices, $callback) { return array_map($callback, $choices); - })); + }); $this->assertSame([null], $this->factory->createListFromChoices($choices, 'property')); } @@ -131,9 +131,9 @@ public function testCreateFromChoiceLoaderAssumeNullIfValuePropertyPathUnreadabl $this->decoratedFactory->expects($this->once()) ->method('createListFromLoader') ->with($loader, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($loader, $callback) { + ->willReturnCallback(function ($loader, $callback) { return $callback(null); - })); + }); $this->assertNull($this->factory->createListFromLoader($loader, 'property')); } @@ -145,9 +145,9 @@ public function testCreateFromLoaderPropertyPathInstance() $this->decoratedFactory->expects($this->once()) ->method('createListFromLoader') ->with($loader, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($loader, $callback) { + ->willReturnCallback(function ($loader, $callback) { return $callback((object) ['property' => 'value']); - })); + }); $this->assertSame('value', $this->factory->createListFromLoader($loader, new PropertyPath('property'))); } @@ -159,9 +159,9 @@ public function testCreateViewPreferredChoicesAsPropertyPath() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred) { + ->willReturnCallback(function ($list, $preferred) { return $preferred((object) ['property' => true]); - })); + }); $this->assertTrue($this->factory->createView( $list, @@ -194,9 +194,9 @@ public function testCreateViewPreferredChoicesAsPropertyPathInstance() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred) { + ->willReturnCallback(function ($list, $preferred) { return $preferred((object) ['property' => true]); - })); + }); $this->assertTrue($this->factory->createView( $list, @@ -212,9 +212,9 @@ public function testCreateViewAssumeNullIfPreferredChoicesPropertyPathUnreadable $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred) { + ->willReturnCallback(function ($list, $preferred) { return $preferred((object) ['category' => null]); - })); + }); $this->assertFalse($this->factory->createView( $list, @@ -229,9 +229,9 @@ public function testCreateViewLabelsAsPropertyPath() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label) { + ->willReturnCallback(function ($list, $preferred, $label) { return $label((object) ['property' => 'label']); - })); + }); $this->assertSame('label', $this->factory->createView( $list, @@ -266,9 +266,9 @@ public function testCreateViewLabelsAsPropertyPathInstance() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label) { + ->willReturnCallback(function ($list, $preferred, $label) { return $label((object) ['property' => 'label']); - })); + }); $this->assertSame('label', $this->factory->createView( $list, @@ -284,9 +284,9 @@ public function testCreateViewIndicesAsPropertyPath() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label, $index) { + ->willReturnCallback(function ($list, $preferred, $label, $index) { return $index((object) ['property' => 'index']); - })); + }); $this->assertSame('index', $this->factory->createView( $list, @@ -323,9 +323,9 @@ public function testCreateViewIndicesAsPropertyPathInstance() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label, $index) { + ->willReturnCallback(function ($list, $preferred, $label, $index) { return $index((object) ['property' => 'index']); - })); + }); $this->assertSame('index', $this->factory->createView( $list, @@ -342,9 +342,9 @@ public function testCreateViewGroupsAsPropertyPath() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy) { + ->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy) { return $groupBy((object) ['property' => 'group']); - })); + }); $this->assertSame('group', $this->factory->createView( $list, @@ -383,9 +383,9 @@ public function testCreateViewGroupsAsPropertyPathInstance() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy) { + ->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy) { return $groupBy((object) ['property' => 'group']); - })); + }); $this->assertSame('group', $this->factory->createView( $list, @@ -404,9 +404,9 @@ public function testCreateViewAssumeNullIfGroupsPropertyPathUnreadable() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy) { + ->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy) { return $groupBy((object) ['group' => null]); - })); + }); $this->assertNull($this->factory->createView( $list, @@ -424,9 +424,9 @@ public function testCreateViewAttrAsPropertyPath() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, null, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy, $attr) { + ->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy, $attr) { return $attr((object) ['property' => 'attr']); - })); + }); $this->assertSame('attr', $this->factory->createView( $list, @@ -467,9 +467,9 @@ public function testCreateViewAttrAsPropertyPathInstance() $this->decoratedFactory->expects($this->once()) ->method('createView') ->with($list, null, null, null, null, $this->isInstanceOf('\Closure')) - ->will($this->returnCallback(function ($list, $preferred, $label, $index, $groupBy, $attr) { + ->willReturnCallback(function ($list, $preferred, $label, $index, $groupBy, $attr) { return $attr((object) ['property' => 'attr']); - })); + }); $this->assertSame('attr', $this->factory->createView( $list, diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php index 60795c4aae1d..6854c43ef733 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php @@ -50,12 +50,12 @@ public function testGetChoiceLoadersLoadsLoadedListOnFirstCall() $this->loader->expects($this->exactly(2)) ->method('loadChoiceList') ->with($this->value) - ->will($this->returnValue($this->loadedList)); + ->willReturn($this->loadedList); // The same list is returned by the loader $this->loadedList->expects($this->exactly(2)) ->method('getChoices') - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); $this->assertSame('RESULT', $this->list->getChoices()); $this->assertSame('RESULT', $this->list->getChoices()); @@ -79,7 +79,7 @@ public function testGetChoicesUsesLoadedListWhenLoaderDoesNotCacheChoiceListOnFi // The same list is returned by the lazy choice list $this->loadedList->expects($this->exactly(2)) ->method('getChoices') - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); $this->assertSame('RESULT', $this->list->getChoices()); $this->assertSame('RESULT', $this->list->getChoices()); @@ -90,12 +90,12 @@ public function testGetValuesLoadsLoadedListOnFirstCall() $this->loader->expects($this->exactly(2)) ->method('loadChoiceList') ->with($this->value) - ->will($this->returnValue($this->loadedList)); + ->willReturn($this->loadedList); // The same list is returned by the loader $this->loadedList->expects($this->exactly(2)) ->method('getValues') - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); $this->assertSame('RESULT', $this->list->getValues()); $this->assertSame('RESULT', $this->list->getValues()); @@ -106,12 +106,12 @@ public function testGetStructuredValuesLoadsLoadedListOnFirstCall() $this->loader->expects($this->exactly(2)) ->method('loadChoiceList') ->with($this->value) - ->will($this->returnValue($this->loadedList)); + ->willReturn($this->loadedList); // The same list is returned by the loader $this->loadedList->expects($this->exactly(2)) ->method('getStructuredValues') - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); $this->assertSame('RESULT', $this->list->getStructuredValues()); $this->assertSame('RESULT', $this->list->getStructuredValues()); @@ -122,12 +122,12 @@ public function testGetOriginalKeysLoadsLoadedListOnFirstCall() $this->loader->expects($this->exactly(2)) ->method('loadChoiceList') ->with($this->value) - ->will($this->returnValue($this->loadedList)); + ->willReturn($this->loadedList); // The same list is returned by the loader $this->loadedList->expects($this->exactly(2)) ->method('getOriginalKeys') - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); $this->assertSame('RESULT', $this->list->getOriginalKeys()); $this->assertSame('RESULT', $this->list->getOriginalKeys()); @@ -138,7 +138,7 @@ public function testGetChoicesForValuesForwardsCallIfListNotLoaded() $this->loader->expects($this->exactly(2)) ->method('loadChoicesForValues') ->with(['a', 'b']) - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); $this->assertSame('RESULT', $this->list->getChoicesForValues(['a', 'b'])); $this->assertSame('RESULT', $this->list->getChoicesForValues(['a', 'b'])); @@ -151,7 +151,7 @@ public function testGetChoicesForValuesUsesLoadedList() ->with($this->value) // For BC, the same choice loaded list is returned 3 times // It should only twice in 4.0 - ->will($this->returnValue($this->loadedList)); + ->willReturn($this->loadedList); $this->loader->expects($this->never()) ->method('loadChoicesForValues'); @@ -159,7 +159,7 @@ public function testGetChoicesForValuesUsesLoadedList() $this->loadedList->expects($this->exactly(2)) ->method('getChoicesForValues') ->with(['a', 'b']) - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); // load choice list $this->list->getChoices(); @@ -176,7 +176,7 @@ public function testGetValuesForChoicesForwardsCallIfListNotLoaded() $this->loader->expects($this->exactly(2)) ->method('loadValuesForChoices') ->with(['a', 'b']) - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); $this->assertSame('RESULT', $this->list->getValuesForChoices(['a', 'b'])); $this->assertSame('RESULT', $this->list->getValuesForChoices(['a', 'b'])); @@ -189,7 +189,7 @@ public function testGetValuesForChoicesUsesLoadedList() ->with($this->value) // For BC, the same choice loaded list is returned 3 times // It should only twice in 4.0 - ->will($this->returnValue($this->loadedList)); + ->willReturn($this->loadedList); $this->loader->expects($this->never()) ->method('loadValuesForChoices'); @@ -197,7 +197,7 @@ public function testGetValuesForChoicesUsesLoadedList() $this->loadedList->expects($this->exactly(2)) ->method('getValuesForChoices') ->with(['a', 'b']) - ->will($this->returnValue('RESULT')); + ->willReturn('RESULT'); // load choice list $this->list->getChoices(); diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index edc3aeda14b2..7657056b7ada 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -179,7 +179,7 @@ public function testAddUsingNameAndType() 'bar' => 'baz', 'auto_initialize' => false, ]) - ->will($this->returnValue($child)); + ->willReturn($child); $this->form->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', ['bar' => 'baz']); @@ -198,7 +198,7 @@ public function testAddUsingIntegerNameAndType() 'bar' => 'baz', 'auto_initialize' => false, ]) - ->will($this->returnValue($child)); + ->willReturn($child); // in order to make casting unnecessary $this->form->add(0, 'Symfony\Component\Form\Extension\Core\Type\TextType', ['bar' => 'baz']); @@ -215,7 +215,7 @@ public function testAddWithoutType() $this->factory->expects($this->once()) ->method('createNamed') ->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType') - ->will($this->returnValue($child)); + ->willReturn($child); $this->form->add('foo'); @@ -236,7 +236,7 @@ public function testAddUsingNameButNoType() $this->factory->expects($this->once()) ->method('createForProperty') ->with('\stdClass', 'foo') - ->will($this->returnValue($child)); + ->willReturn($child); $this->form->add('foo'); @@ -260,7 +260,7 @@ public function testAddUsingNameButNoTypeAndOptions() 'bar' => 'baz', 'auto_initialize' => false, ]) - ->will($this->returnValue($child)); + ->willReturn($child); $this->form->add('foo', null, ['bar' => 'baz']); @@ -352,10 +352,10 @@ public function testAddMapsViewDataToFormIfInitialized() $mapper->expects($this->once()) ->method('mapDataToForms') ->with('bar', $this->isInstanceOf('\RecursiveIteratorIterator')) - ->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child) { + ->willReturnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child) { $this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); $this->assertSame([$child->getName() => $child], iterator_to_array($iterator)); - })); + }); $form->initialize(); $form->add($child); @@ -442,10 +442,10 @@ public function testSetDataMapsViewDataToChildren() $mapper->expects($this->once()) ->method('mapDataToForms') ->with('bar', $this->isInstanceOf('\RecursiveIteratorIterator')) - ->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child1, $child2) { + ->willReturnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child1, $child2) { $this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); $this->assertSame(['firstName' => $child1, 'lastName' => $child2], iterator_to_array($iterator)); - })); + }); $form->setData('foo'); } @@ -517,12 +517,12 @@ public function testSubmitMapsSubmittedChildrenOntoExistingViewData() $mapper->expects($this->once()) ->method('mapFormsToData') ->with($this->isInstanceOf('\RecursiveIteratorIterator'), 'bar') - ->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child1, $child2) { + ->willReturnCallback(function (\RecursiveIteratorIterator $iterator) use ($child1, $child2) { $this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); $this->assertSame(['firstName' => $child1, 'lastName' => $child2], iterator_to_array($iterator)); $this->assertEquals('Bernhard', $child1->getData()); $this->assertEquals('Schussek', $child2->getData()); - })); + }); $form->submit([ 'firstName' => 'Bernhard', @@ -589,10 +589,10 @@ public function testSubmitMapsSubmittedChildrenOntoEmptyData() $mapper->expects($this->once()) ->method('mapFormsToData') ->with($this->isInstanceOf('\RecursiveIteratorIterator'), $object) - ->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child) { + ->willReturnCallback(function (\RecursiveIteratorIterator $iterator) use ($child) { $this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator()); $this->assertSame(['name' => $child], iterator_to_array($iterator)); - })); + }); $form->submit([ 'name' => 'Bernhard', @@ -912,11 +912,11 @@ public function testCreateViewWithChildren() $field1View = new FormView(); $type1 ->method('createView') - ->will($this->returnValue($field1View)); + ->willReturn($field1View); $field2View = new FormView(); $type2 ->method('createView') - ->will($this->returnValue($field2View)); + ->willReturn($field2View); $this->form = $this->getBuilder('form', null, null, $options) ->setCompound(true) @@ -935,13 +935,13 @@ public function testCreateViewWithChildren() // First create the view $type->expects($this->once()) ->method('createView') - ->will($this->returnValue($view)); + ->willReturn($view); // Then build it for the form itself $type->expects($this->once()) ->method('buildView') ->with($view, $this->form, $options) - ->will($this->returnCallback($assertChildViewsEqual([]))); + ->willReturnCallback($assertChildViewsEqual([])); $this->assertSame($view, $this->form->createView()); $this->assertSame(['foo' => $field1View, 'bar' => $field2View], $view->children); @@ -961,7 +961,7 @@ public function testNoClickedButton() $button->expects($this->any()) ->method('isClicked') - ->will($this->returnValue(false)); + ->willReturn(false); $parentForm = $this->getBuilder('parent')->getForm(); $nestedForm = $this->getBuilder('nested')->getForm(); @@ -983,7 +983,7 @@ public function testClickedButton() $button->expects($this->any()) ->method('isClicked') - ->will($this->returnValue(true)); + ->willReturn(true); $this->form->add($button); $this->form->submit([]); @@ -1002,7 +1002,7 @@ public function testClickedButtonFromNestedForm() $nestedForm->expects($this->any()) ->method('getClickedButton') - ->will($this->returnValue($button)); + ->willReturn($button); $this->form->add($nestedForm); $this->form->submit([]); @@ -1021,7 +1021,7 @@ public function testClickedButtonFromParentForm() $parentForm->expects($this->any()) ->method('getClickedButton') - ->will($this->returnValue($button)); + ->willReturn($button); $this->form->setParent($parentForm); $this->form->submit([]); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php index f62d3c52110f..2c685a4197a9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php @@ -22,12 +22,12 @@ public function testTransform() $transformer1->expects($this->once()) ->method('transform') ->with($this->identicalTo('foo')) - ->will($this->returnValue('bar')); + ->willReturn('bar'); $transformer2 = $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock(); $transformer2->expects($this->once()) ->method('transform') ->with($this->identicalTo('bar')) - ->will($this->returnValue('baz')); + ->willReturn('baz'); $chain = new DataTransformerChain([$transformer1, $transformer2]); @@ -40,12 +40,12 @@ public function testReverseTransform() $transformer2->expects($this->once()) ->method('reverseTransform') ->with($this->identicalTo('foo')) - ->will($this->returnValue('bar')); + ->willReturn('bar'); $transformer1 = $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock(); $transformer1->expects($this->once()) ->method('reverseTransform') ->with($this->identicalTo('bar')) - ->will($this->returnValue('baz')); + ->willReturn('baz'); $chain = new DataTransformerChain([$transformer1, $transformer2]); diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php index 083f1c956792..665b70047973 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php @@ -122,7 +122,7 @@ public function testGenerateCsrfToken() $this->tokenManager->expects($this->once()) ->method('getToken') ->with('TOKEN_ID') - ->will($this->returnValue(new CsrfToken('TOKEN_ID', 'token'))); + ->willReturn(new CsrfToken('TOKEN_ID', 'token')); $view = $this->factory ->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, [ @@ -141,7 +141,7 @@ public function testGenerateCsrfTokenUsesFormNameAsIntentionByDefault() $this->tokenManager->expects($this->once()) ->method('getToken') ->with('FORM_NAME') - ->will($this->returnValue('token')); + ->willReturn('token'); $view = $this->factory ->createNamed('FORM_NAME', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, [ @@ -159,7 +159,7 @@ public function testGenerateCsrfTokenUsesTypeClassAsIntentionIfEmptyFormName() $this->tokenManager->expects($this->once()) ->method('getToken') ->with('Symfony\Component\Form\Extension\Core\Type\FormType') - ->will($this->returnValue('token')); + ->willReturn('token'); $view = $this->factory ->createNamed('', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, [ @@ -188,7 +188,7 @@ public function testValidateTokenOnSubmitIfRootAndCompound($valid) $this->tokenManager->expects($this->once()) ->method('isTokenValid') ->with(new CsrfToken('TOKEN_ID', 'token')) - ->will($this->returnValue($valid)); + ->willReturn($valid); $form = $this->factory ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, [ @@ -220,7 +220,7 @@ public function testValidateTokenOnSubmitIfRootAndCompoundUsesFormNameAsIntentio $this->tokenManager->expects($this->once()) ->method('isTokenValid') ->with(new CsrfToken('FORM_NAME', 'token')) - ->will($this->returnValue($valid)); + ->willReturn($valid); $form = $this->factory ->createNamedBuilder('FORM_NAME', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, [ @@ -251,7 +251,7 @@ public function testValidateTokenOnSubmitIfRootAndCompoundUsesTypeClassAsIntenti $this->tokenManager->expects($this->once()) ->method('isTokenValid') ->with(new CsrfToken('Symfony\Component\Form\Extension\Core\Type\FormType', 'token')) - ->will($this->returnValue($valid)); + ->willReturn($valid); $form = $this->factory ->createNamedBuilder('', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, [ @@ -366,12 +366,12 @@ public function testsTranslateCustomErrorMessage() $this->tokenManager->expects($this->once()) ->method('isTokenValid') ->with(new CsrfToken('TOKEN_ID', 'token')) - ->will($this->returnValue(false)); + ->willReturn(false); $this->translator->expects($this->once()) ->method('trans') ->with('Foobar') - ->will($this->returnValue('[trans]Foobar[/trans]')); + ->willReturn('[trans]Foobar[/trans]'); $form = $this->factory ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, [ diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php index 2ca0f95f3c6e..83d44167d5cf 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php @@ -84,29 +84,29 @@ public function testBuildPreliminaryFormTree() $this->dataExtractor->expects($this->at(0)) ->method('extractConfiguration') ->with($this->form) - ->will($this->returnValue(['config' => 'foo'])); + ->willReturn(['config' => 'foo']); $this->dataExtractor->expects($this->at(1)) ->method('extractConfiguration') ->with($this->childForm) - ->will($this->returnValue(['config' => 'bar'])); + ->willReturn(['config' => 'bar']); $this->dataExtractor->expects($this->at(2)) ->method('extractDefaultData') ->with($this->form) - ->will($this->returnValue(['default_data' => 'foo'])); + ->willReturn(['default_data' => 'foo']); $this->dataExtractor->expects($this->at(3)) ->method('extractDefaultData') ->with($this->childForm) - ->will($this->returnValue(['default_data' => 'bar'])); + ->willReturn(['default_data' => 'bar']); $this->dataExtractor->expects($this->at(4)) ->method('extractSubmittedData') ->with($this->form) - ->will($this->returnValue(['submitted_data' => 'foo'])); + ->willReturn(['submitted_data' => 'foo']); $this->dataExtractor->expects($this->at(5)) ->method('extractSubmittedData') ->with($this->childForm) - ->will($this->returnValue(['submitted_data' => 'bar'])); + ->willReturn(['submitted_data' => 'bar']); $this->dataCollector->collectConfiguration($this->form); $this->dataCollector->collectDefaultData($this->form); @@ -150,11 +150,11 @@ public function testBuildMultiplePreliminaryFormTrees() $this->dataExtractor->expects($this->at(0)) ->method('extractConfiguration') ->with($form1) - ->will($this->returnValue(['config' => 'foo'])); + ->willReturn(['config' => 'foo']); $this->dataExtractor->expects($this->at(1)) ->method('extractConfiguration') ->with($form2) - ->will($this->returnValue(['config' => 'bar'])); + ->willReturn(['config' => 'bar']); $this->dataCollector->collectConfiguration($form1); $this->dataCollector->collectConfiguration($form2); @@ -200,12 +200,12 @@ public function testBuildSamePreliminaryFormTreeMultipleTimes() $this->dataExtractor->expects($this->at(0)) ->method('extractConfiguration') ->with($this->form) - ->will($this->returnValue(['config' => 'foo'])); + ->willReturn(['config' => 'foo']); $this->dataExtractor->expects($this->at(1)) ->method('extractDefaultData') ->with($this->form) - ->will($this->returnValue(['default_data' => 'foo'])); + ->willReturn(['default_data' => 'foo']); $this->dataCollector->collectConfiguration($this->form); $this->dataCollector->buildPreliminaryFormTree($this->form); @@ -272,39 +272,39 @@ public function testBuildFinalFormTree() $this->dataExtractor->expects($this->at(0)) ->method('extractConfiguration') ->with($this->form) - ->will($this->returnValue(['config' => 'foo'])); + ->willReturn(['config' => 'foo']); $this->dataExtractor->expects($this->at(1)) ->method('extractConfiguration') ->with($this->childForm) - ->will($this->returnValue(['config' => 'bar'])); + ->willReturn(['config' => 'bar']); $this->dataExtractor->expects($this->at(2)) ->method('extractDefaultData') ->with($this->form) - ->will($this->returnValue(['default_data' => 'foo'])); + ->willReturn(['default_data' => 'foo']); $this->dataExtractor->expects($this->at(3)) ->method('extractDefaultData') ->with($this->childForm) - ->will($this->returnValue(['default_data' => 'bar'])); + ->willReturn(['default_data' => 'bar']); $this->dataExtractor->expects($this->at(4)) ->method('extractSubmittedData') ->with($this->form) - ->will($this->returnValue(['submitted_data' => 'foo'])); + ->willReturn(['submitted_data' => 'foo']); $this->dataExtractor->expects($this->at(5)) ->method('extractSubmittedData') ->with($this->childForm) - ->will($this->returnValue(['submitted_data' => 'bar'])); + ->willReturn(['submitted_data' => 'bar']); $this->dataExtractor->expects($this->at(6)) ->method('extractViewVariables') ->with($this->view) - ->will($this->returnValue(['view_vars' => 'foo'])); + ->willReturn(['view_vars' => 'foo']); $this->dataExtractor->expects($this->at(7)) ->method('extractViewVariables') ->with($this->childView) - ->will($this->returnValue(['view_vars' => 'bar'])); + ->willReturn(['view_vars' => 'bar']); $this->dataCollector->collectConfiguration($this->form); $this->dataCollector->collectDefaultData($this->form); @@ -365,76 +365,76 @@ public function testSerializeWithFormAddedMultipleTimes() $this->dataExtractor->expects($this->at(0)) ->method('extractConfiguration') ->with($form1) - ->will($this->returnValue(['config' => 'foo'])); + ->willReturn(['config' => 'foo']); $this->dataExtractor->expects($this->at(1)) ->method('extractConfiguration') ->with($child1) - ->will($this->returnValue(['config' => 'bar'])); + ->willReturn(['config' => 'bar']); $this->dataExtractor->expects($this->at(2)) ->method('extractDefaultData') ->with($form1) - ->will($this->returnValue(['default_data' => 'foo'])); + ->willReturn(['default_data' => 'foo']); $this->dataExtractor->expects($this->at(3)) ->method('extractDefaultData') ->with($child1) - ->will($this->returnValue(['default_data' => 'bar'])); + ->willReturn(['default_data' => 'bar']); $this->dataExtractor->expects($this->at(4)) ->method('extractSubmittedData') ->with($form1) - ->will($this->returnValue(['submitted_data' => 'foo'])); + ->willReturn(['submitted_data' => 'foo']); $this->dataExtractor->expects($this->at(5)) ->method('extractSubmittedData') ->with($child1) - ->will($this->returnValue(['submitted_data' => 'bar'])); + ->willReturn(['submitted_data' => 'bar']); $this->dataExtractor->expects($this->at(6)) ->method('extractViewVariables') ->with($form1View) - ->will($this->returnValue(['view_vars' => 'foo'])); + ->willReturn(['view_vars' => 'foo']); $this->dataExtractor->expects($this->at(7)) ->method('extractViewVariables') ->with($child1View) - ->will($this->returnValue(['view_vars' => $child1View->vars])); + ->willReturn(['view_vars' => $child1View->vars]); $this->dataExtractor->expects($this->at(8)) ->method('extractConfiguration') ->with($form2) - ->will($this->returnValue(['config' => 'foo'])); + ->willReturn(['config' => 'foo']); $this->dataExtractor->expects($this->at(9)) ->method('extractConfiguration') ->with($child1) - ->will($this->returnValue(['config' => 'bar'])); + ->willReturn(['config' => 'bar']); $this->dataExtractor->expects($this->at(10)) ->method('extractDefaultData') ->with($form2) - ->will($this->returnValue(['default_data' => 'foo'])); + ->willReturn(['default_data' => 'foo']); $this->dataExtractor->expects($this->at(11)) ->method('extractDefaultData') ->with($child1) - ->will($this->returnValue(['default_data' => 'bar'])); + ->willReturn(['default_data' => 'bar']); $this->dataExtractor->expects($this->at(12)) ->method('extractSubmittedData') ->with($form2) - ->will($this->returnValue(['submitted_data' => 'foo'])); + ->willReturn(['submitted_data' => 'foo']); $this->dataExtractor->expects($this->at(13)) ->method('extractSubmittedData') ->with($child1) - ->will($this->returnValue(['submitted_data' => 'bar'])); + ->willReturn(['submitted_data' => 'bar']); $this->dataExtractor->expects($this->at(14)) ->method('extractViewVariables') ->with($form2View) - ->will($this->returnValue(['view_vars' => 'foo'])); + ->willReturn(['view_vars' => 'foo']); $this->dataExtractor->expects($this->at(15)) ->method('extractViewVariables') ->with($child1View) - ->will($this->returnValue(['view_vars' => $child1View->vars])); + ->willReturn(['view_vars' => $child1View->vars]); $this->dataCollector->collectConfiguration($form1); $this->dataCollector->collectDefaultData($form1); @@ -518,11 +518,11 @@ public function testChildViewsCanBeWithoutCorrespondingChildForms() $this->dataExtractor->expects($this->at(0)) ->method('extractConfiguration') ->with($this->form) - ->will($this->returnValue(['config' => 'foo'])); + ->willReturn(['config' => 'foo']); $this->dataExtractor->expects($this->at(1)) ->method('extractConfiguration') ->with($this->childForm) - ->will($this->returnValue(['config' => 'bar'])); + ->willReturn(['config' => 'bar']); // explicitly call collectConfiguration(), since $this->childForm is not // contained in the form tree @@ -566,11 +566,11 @@ public function testChildViewsWithoutCorrespondingChildFormsMayBeExplicitlyAssoc $this->dataExtractor->expects($this->at(0)) ->method('extractConfiguration') ->with($this->form) - ->will($this->returnValue(['config' => 'foo'])); + ->willReturn(['config' => 'foo']); $this->dataExtractor->expects($this->at(1)) ->method('extractConfiguration') ->with($this->childForm) - ->will($this->returnValue(['config' => 'bar'])); + ->willReturn(['config' => 'bar']); // explicitly call collectConfiguration(), since $this->childForm is not // contained in the form tree @@ -611,22 +611,22 @@ public function testCollectSubmittedDataCountsErrors() $form1->add($childForm1); $this->dataExtractor ->method('extractConfiguration') - ->will($this->returnValue([])); + ->willReturn([]); $this->dataExtractor ->method('extractDefaultData') - ->will($this->returnValue([])); + ->willReturn([]); $this->dataExtractor->expects($this->at(4)) ->method('extractSubmittedData') ->with($form1) - ->will($this->returnValue(['errors' => ['foo']])); + ->willReturn(['errors' => ['foo']]); $this->dataExtractor->expects($this->at(5)) ->method('extractSubmittedData') ->with($childForm1) - ->will($this->returnValue(['errors' => ['bar', 'bam']])); + ->willReturn(['errors' => ['bar', 'bam']]); $this->dataExtractor->expects($this->at(8)) ->method('extractSubmittedData') ->with($form2) - ->will($this->returnValue(['errors' => ['baz']])); + ->willReturn(['errors' => ['baz']]); $this->dataCollector->collectSubmittedData($form1); @@ -653,30 +653,30 @@ public function testCollectSubmittedDataExpandedFormsErrors() $this->dataExtractor ->method('extractConfiguration') - ->will($this->returnValue([])); + ->willReturn([]); $this->dataExtractor ->method('extractDefaultData') - ->will($this->returnValue([])); + ->willReturn([]); $this->dataExtractor->expects($this->at(10)) ->method('extractSubmittedData') ->with($this->form) - ->will($this->returnValue(['errors' => []])); + ->willReturn(['errors' => []]); $this->dataExtractor->expects($this->at(11)) ->method('extractSubmittedData') ->with($child1Form) - ->will($this->returnValue(['errors' => []])); + ->willReturn(['errors' => []]); $this->dataExtractor->expects($this->at(12)) ->method('extractSubmittedData') ->with($child11Form) - ->will($this->returnValue(['errors' => ['foo']])); + ->willReturn(['errors' => ['foo']]); $this->dataExtractor->expects($this->at(13)) ->method('extractSubmittedData') ->with($child2Form) - ->will($this->returnValue(['errors' => []])); + ->willReturn(['errors' => []]); $this->dataExtractor->expects($this->at(14)) ->method('extractSubmittedData') ->with($child21Form) - ->will($this->returnValue(['errors' => []])); + ->willReturn(['errors' => []]); $this->dataCollector->collectSubmittedData($this->form); $this->dataCollector->buildPreliminaryFormTree($this->form); @@ -701,14 +701,14 @@ public function testReset() $this->dataExtractor->expects($this->any()) ->method('extractConfiguration') - ->will($this->returnValue([])); + ->willReturn([]); $this->dataExtractor->expects($this->any()) ->method('extractDefaultData') - ->will($this->returnValue([])); + ->willReturn([]); $this->dataExtractor->expects($this->any()) ->method('extractSubmittedData') ->with($form) - ->will($this->returnValue(['errors' => ['baz']])); + ->willReturn(['errors' => ['baz']]); $this->dataCollector->buildPreliminaryFormTree($form); $this->dataCollector->collectSubmittedData($form); diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php index 9bbfb0f4f11e..860a96abcddf 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php @@ -56,7 +56,7 @@ public function testExtractConfiguration() $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock(); $type->expects($this->any()) ->method('getInnerType') - ->will($this->returnValue(new \stdClass())); + ->willReturn(new \stdClass()); $form = $this->createBuilder('name') ->setType($type) @@ -77,7 +77,7 @@ public function testExtractConfigurationSortsPassedOptions() $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock(); $type->expects($this->any()) ->method('getInnerType') - ->will($this->returnValue(new \stdClass())); + ->willReturn(new \stdClass()); $options = [ 'b' => 'foo', @@ -111,7 +111,7 @@ public function testExtractConfigurationSortsResolvedOptions() $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock(); $type->expects($this->any()) ->method('getInnerType') - ->will($this->returnValue(new \stdClass())); + ->willReturn(new \stdClass()); $options = [ 'b' => 'foo', @@ -142,7 +142,7 @@ public function testExtractConfigurationBuildsIdRecursively() $type = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeInterface')->getMock(); $type->expects($this->any()) ->method('getInnerType') - ->will($this->returnValue(new \stdClass())); + ->willReturn(new \stdClass()); $grandParent = $this->createBuilder('grandParent') ->setCompound(true) diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php index 53d29a19112c..57f92b6574e3 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php @@ -42,7 +42,7 @@ public function testSubmitValidatesData() $this->validator->expects($this->once()) ->method('validate') ->with($this->equalTo($form)) - ->will($this->returnValue(new ConstraintViolationList())); + ->willReturn(new ConstraintViolationList()); // specific data is irrelevant $form->submit([]); diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php index ecab2bb5d91e..1247a80bbda3 100644 --- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -91,7 +91,7 @@ public function testAll() $this->factory->expects($this->once()) ->method('createNamedBuilder') ->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType') - ->will($this->returnValue(new FormBuilder('foo', null, $this->dispatcher, $this->factory))); + ->willReturn(new FormBuilder('foo', null, $this->dispatcher, $this->factory)); $this->assertCount(0, $this->builder->all()); $this->assertFalse($this->builder->has('foo')); @@ -186,7 +186,7 @@ public function testGetExplicitType() $this->factory->expects($this->once()) ->method('createNamedBuilder') ->with($expectedName, $expectedType, null, $expectedOptions) - ->will($this->returnValue($this->getFormBuilder())); + ->willReturn($this->getFormBuilder()); $this->builder->add($expectedName, $expectedType, $expectedOptions); $builder = $this->builder->get($expectedName); @@ -202,7 +202,7 @@ public function testGetGuessedType() $this->factory->expects($this->once()) ->method('createBuilderForProperty') ->with('stdClass', $expectedName, null, $expectedOptions) - ->will($this->returnValue($this->getFormBuilder())); + ->willReturn($this->getFormBuilder()); $this->builder = new FormBuilder('name', 'stdClass', $this->dispatcher, $this->factory); $this->builder->add($expectedName, null, $expectedOptions); @@ -236,7 +236,7 @@ private function getFormBuilder($name = 'name') $mock->expects($this->any()) ->method('getName') - ->will($this->returnValue($name)); + ->willReturn($name); return $mock; } diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php index 27a5ca6e20f7..442631067653 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -58,10 +58,10 @@ protected function setUp() $this->registry->expects($this->any()) ->method('getTypeGuesser') - ->will($this->returnValue(new FormTypeGuesserChain([ + ->willReturn(new FormTypeGuesserChain([ $this->guesser1, $this->guesser2, - ]))); + ])); } public function testCreateNamedBuilderWithTypeName() @@ -73,16 +73,16 @@ public function testCreateNamedBuilderWithTypeName() $this->registry->expects($this->once()) ->method('getType') ->with('type') - ->will($this->returnValue($resolvedType)); + ->willReturn($resolvedType); $resolvedType->expects($this->once()) ->method('createBuilder') ->with($this->factory, 'name', $options) - ->will($this->returnValue($this->builder)); + ->willReturn($this->builder); $this->builder->expects($this->any()) ->method('getOptions') - ->will($this->returnValue($resolvedOptions)); + ->willReturn($resolvedOptions); $resolvedType->expects($this->once()) ->method('buildForm') @@ -101,16 +101,16 @@ public function testCreateNamedBuilderFillsDataOption() $this->registry->expects($this->once()) ->method('getType') ->with('type') - ->will($this->returnValue($resolvedType)); + ->willReturn($resolvedType); $resolvedType->expects($this->once()) ->method('createBuilder') ->with($this->factory, 'name', $expectedOptions) - ->will($this->returnValue($this->builder)); + ->willReturn($this->builder); $this->builder->expects($this->any()) ->method('getOptions') - ->will($this->returnValue($resolvedOptions)); + ->willReturn($resolvedOptions); $resolvedType->expects($this->once()) ->method('buildForm') @@ -128,16 +128,16 @@ public function testCreateNamedBuilderDoesNotOverrideExistingDataOption() $this->registry->expects($this->once()) ->method('getType') ->with('type') - ->will($this->returnValue($resolvedType)); + ->willReturn($resolvedType); $resolvedType->expects($this->once()) ->method('createBuilder') ->with($this->factory, 'name', $options) - ->will($this->returnValue($this->builder)); + ->willReturn($this->builder); $this->builder->expects($this->any()) ->method('getOptions') - ->will($this->returnValue($resolvedOptions)); + ->willReturn($resolvedOptions); $resolvedType->expects($this->once()) ->method('buildForm') @@ -181,16 +181,16 @@ public function testCreateUsesBlockPrefixIfTypeGivenAsString() $this->registry->expects($this->any()) ->method('getType') ->with('TYPE') - ->will($this->returnValue($resolvedType)); + ->willReturn($resolvedType); $resolvedType->expects($this->once()) ->method('createBuilder') ->with($this->factory, 'TYPE_PREFIX', $options) - ->will($this->returnValue($this->builder)); + ->willReturn($this->builder); $this->builder->expects($this->any()) ->method('getOptions') - ->will($this->returnValue($resolvedOptions)); + ->willReturn($resolvedOptions); $resolvedType->expects($this->once()) ->method('buildForm') @@ -198,7 +198,7 @@ public function testCreateUsesBlockPrefixIfTypeGivenAsString() $this->builder->expects($this->once()) ->method('getForm') - ->will($this->returnValue('FORM')); + ->willReturn('FORM'); $this->assertSame('FORM', $this->factory->create('TYPE', null, $options)); } @@ -212,16 +212,16 @@ public function testCreateNamed() $this->registry->expects($this->once()) ->method('getType') ->with('type') - ->will($this->returnValue($resolvedType)); + ->willReturn($resolvedType); $resolvedType->expects($this->once()) ->method('createBuilder') ->with($this->factory, 'name', $options) - ->will($this->returnValue($this->builder)); + ->willReturn($this->builder); $this->builder->expects($this->any()) ->method('getOptions') - ->will($this->returnValue($resolvedOptions)); + ->willReturn($resolvedOptions); $resolvedType->expects($this->once()) ->method('buildForm') @@ -229,7 +229,7 @@ public function testCreateNamed() $this->builder->expects($this->once()) ->method('getForm') - ->will($this->returnValue('FORM')); + ->willReturn('FORM'); $this->assertSame('FORM', $this->factory->createNamed('name', 'type', null, $options)); } @@ -245,7 +245,7 @@ public function testCreateBuilderForPropertyWithoutTypeGuesser() $factory->expects($this->once()) ->method('createNamedBuilder') ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, []) - ->will($this->returnValue('builderInstance')); + ->willReturn('builderInstance'); $this->builder = $factory->createBuilderForProperty('Application\Author', 'firstName'); @@ -257,27 +257,27 @@ public function testCreateBuilderForPropertyCreatesFormWithHighestConfidence() $this->guesser1->expects($this->once()) ->method('guessType') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new TypeGuess( + ->willReturn(new TypeGuess( 'Symfony\Component\Form\Extension\Core\Type\TextType', ['attr' => ['maxlength' => 10]], Guess::MEDIUM_CONFIDENCE - ))); + )); $this->guesser2->expects($this->once()) ->method('guessType') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new TypeGuess( + ->willReturn(new TypeGuess( 'Symfony\Component\Form\Extension\Core\Type\PasswordType', ['attr' => ['maxlength' => 7]], Guess::HIGH_CONFIDENCE - ))); + )); $factory = $this->getMockFactory(['createNamedBuilder']); $factory->expects($this->once()) ->method('createNamedBuilder') ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', null, ['attr' => ['maxlength' => 7]]) - ->will($this->returnValue('builderInstance')); + ->willReturn('builderInstance'); $this->builder = $factory->createBuilderForProperty('Application\Author', 'firstName'); @@ -289,14 +289,14 @@ public function testCreateBuilderCreatesTextFormIfNoGuess() $this->guesser1->expects($this->once()) ->method('guessType') ->with('Application\Author', 'firstName') - ->will($this->returnValue(null)); + ->willReturn(null); $factory = $this->getMockFactory(['createNamedBuilder']); $factory->expects($this->once()) ->method('createNamedBuilder') ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType') - ->will($this->returnValue('builderInstance')); + ->willReturn('builderInstance'); $this->builder = $factory->createBuilderForProperty('Application\Author', 'firstName'); @@ -308,18 +308,18 @@ public function testOptionsCanBeOverridden() $this->guesser1->expects($this->once()) ->method('guessType') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new TypeGuess( + ->willReturn(new TypeGuess( 'Symfony\Component\Form\Extension\Core\Type\TextType', ['attr' => ['class' => 'foo', 'maxlength' => 10]], Guess::MEDIUM_CONFIDENCE - ))); + )); $factory = $this->getMockFactory(['createNamedBuilder']); $factory->expects($this->once()) ->method('createNamedBuilder') ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['attr' => ['class' => 'foo', 'maxlength' => 11]]) - ->will($this->returnValue('builderInstance')); + ->willReturn('builderInstance'); $this->builder = $factory->createBuilderForProperty( 'Application\Author', @@ -336,25 +336,25 @@ public function testCreateBuilderUsesMaxLengthIfFound() $this->guesser1->expects($this->once()) ->method('guessMaxLength') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new ValueGuess( + ->willReturn(new ValueGuess( 15, Guess::MEDIUM_CONFIDENCE - ))); + )); $this->guesser2->expects($this->once()) ->method('guessMaxLength') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new ValueGuess( + ->willReturn(new ValueGuess( 20, Guess::HIGH_CONFIDENCE - ))); + )); $factory = $this->getMockFactory(['createNamedBuilder']); $factory->expects($this->once()) ->method('createNamedBuilder') ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['attr' => ['maxlength' => 20]]) - ->will($this->returnValue('builderInstance')); + ->willReturn('builderInstance'); $this->builder = $factory->createBuilderForProperty( 'Application\Author', @@ -369,25 +369,25 @@ public function testCreateBuilderUsesMaxLengthAndPattern() $this->guesser1->expects($this->once()) ->method('guessMaxLength') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new ValueGuess( + ->willReturn(new ValueGuess( 20, Guess::HIGH_CONFIDENCE - ))); + )); $this->guesser2->expects($this->once()) ->method('guessPattern') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new ValueGuess( + ->willReturn(new ValueGuess( '.{5,}', Guess::HIGH_CONFIDENCE - ))); + )); $factory = $this->getMockFactory(['createNamedBuilder']); $factory->expects($this->once()) ->method('createNamedBuilder') ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['attr' => ['maxlength' => 20, 'pattern' => '.{5,}', 'class' => 'tinymce']]) - ->will($this->returnValue('builderInstance')); + ->willReturn('builderInstance'); $this->builder = $factory->createBuilderForProperty( 'Application\Author', @@ -404,25 +404,25 @@ public function testCreateBuilderUsesRequiredSettingWithHighestConfidence() $this->guesser1->expects($this->once()) ->method('guessRequired') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new ValueGuess( + ->willReturn(new ValueGuess( true, Guess::MEDIUM_CONFIDENCE - ))); + )); $this->guesser2->expects($this->once()) ->method('guessRequired') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new ValueGuess( + ->willReturn(new ValueGuess( false, Guess::HIGH_CONFIDENCE - ))); + )); $factory = $this->getMockFactory(['createNamedBuilder']); $factory->expects($this->once()) ->method('createNamedBuilder') ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['required' => false]) - ->will($this->returnValue('builderInstance')); + ->willReturn('builderInstance'); $this->builder = $factory->createBuilderForProperty( 'Application\Author', @@ -437,25 +437,25 @@ public function testCreateBuilderUsesPatternIfFound() $this->guesser1->expects($this->once()) ->method('guessPattern') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new ValueGuess( + ->willReturn(new ValueGuess( '[a-z]', Guess::MEDIUM_CONFIDENCE - ))); + )); $this->guesser2->expects($this->once()) ->method('guessPattern') ->with('Application\Author', 'firstName') - ->will($this->returnValue(new ValueGuess( + ->willReturn(new ValueGuess( '[a-zA-Z]', Guess::HIGH_CONFIDENCE - ))); + )); $factory = $this->getMockFactory(['createNamedBuilder']); $factory->expects($this->once()) ->method('createNamedBuilder') ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, ['attr' => ['pattern' => '[a-zA-Z]']]) - ->will($this->returnValue('builderInstance')); + ->willReturn('builderInstance'); $this->builder = $factory->createBuilderForProperty( 'Application\Author', diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php index 32bb8bb78871..ba078ad1fd11 100644 --- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -99,21 +99,21 @@ public function testGetOptionsResolver() // First the default options are generated for the super type $this->parentType->expects($this->once()) ->method('configureOptions') - ->will($this->returnCallback($assertIndexAndAddOption(0, 'a', 'a_default'))); + ->willReturnCallback($assertIndexAndAddOption(0, 'a', 'a_default')); // The form type itself $this->type->expects($this->once()) ->method('configureOptions') - ->will($this->returnCallback($assertIndexAndAddOption(1, 'b', 'b_default'))); + ->willReturnCallback($assertIndexAndAddOption(1, 'b', 'b_default')); // And its extensions $this->extension1->expects($this->once()) ->method('configureOptions') - ->will($this->returnCallback($assertIndexAndAddOption(2, 'c', 'c_default'))); + ->willReturnCallback($assertIndexAndAddOption(2, 'c', 'c_default')); $this->extension2->expects($this->once()) ->method('configureOptions') - ->will($this->returnCallback($assertIndexAndAddOption(3, 'd', 'd_default'))); + ->willReturnCallback($assertIndexAndAddOption(3, 'd', 'd_default')); $givenOptions = ['a' => 'a_custom', 'c' => 'c_custom']; $resolvedOptions = ['a' => 'a_custom', 'b' => 'b_default', 'c' => 'c_custom', 'd' => 'd_default']; @@ -136,12 +136,12 @@ public function testCreateBuilder() $this->resolvedType->expects($this->once()) ->method('getOptionsResolver') - ->will($this->returnValue($optionsResolver)); + ->willReturn($optionsResolver); $optionsResolver->expects($this->once()) ->method('resolve') ->with($givenOptions) - ->will($this->returnValue($resolvedOptions)); + ->willReturn($resolvedOptions); $factory = $this->getMockFormFactory(); $builder = $this->resolvedType->createBuilder($factory, 'name', $givenOptions); @@ -164,12 +164,12 @@ public function testCreateBuilderWithDataClassOption() $this->resolvedType->expects($this->once()) ->method('getOptionsResolver') - ->will($this->returnValue($optionsResolver)); + ->willReturn($optionsResolver); $optionsResolver->expects($this->once()) ->method('resolve') ->with($givenOptions) - ->will($this->returnValue($resolvedOptions)); + ->willReturn($resolvedOptions); $factory = $this->getMockFormFactory(); $builder = $this->resolvedType->createBuilder($factory, 'name', $givenOptions); @@ -198,24 +198,24 @@ public function testBuildForm() $this->parentType->expects($this->once()) ->method('buildForm') ->with($builder, $options) - ->will($this->returnCallback($assertIndex(0))); + ->willReturnCallback($assertIndex(0)); // Then the type itself $this->type->expects($this->once()) ->method('buildForm') ->with($builder, $options) - ->will($this->returnCallback($assertIndex(1))); + ->willReturnCallback($assertIndex(1)); // Then its extensions $this->extension1->expects($this->once()) ->method('buildForm') ->with($builder, $options) - ->will($this->returnCallback($assertIndex(2))); + ->willReturnCallback($assertIndex(2)); $this->extension2->expects($this->once()) ->method('buildForm') ->with($builder, $options) - ->will($this->returnCallback($assertIndex(3))); + ->willReturnCallback($assertIndex(3)); $this->resolvedType->buildForm($builder, $options); } @@ -261,24 +261,24 @@ public function testBuildView() $this->parentType->expects($this->once()) ->method('buildView') ->with($view, $form, $options) - ->will($this->returnCallback($assertIndex(0))); + ->willReturnCallback($assertIndex(0)); // Then the type itself $this->type->expects($this->once()) ->method('buildView') ->with($view, $form, $options) - ->will($this->returnCallback($assertIndex(1))); + ->willReturnCallback($assertIndex(1)); // Then its extensions $this->extension1->expects($this->once()) ->method('buildView') ->with($view, $form, $options) - ->will($this->returnCallback($assertIndex(2))); + ->willReturnCallback($assertIndex(2)); $this->extension2->expects($this->once()) ->method('buildView') ->with($view, $form, $options) - ->will($this->returnCallback($assertIndex(3))); + ->willReturnCallback($assertIndex(3)); $this->resolvedType->buildView($view, $form, $options); } @@ -303,24 +303,24 @@ public function testFinishView() $this->parentType->expects($this->once()) ->method('finishView') ->with($view, $form, $options) - ->will($this->returnCallback($assertIndex(0))); + ->willReturnCallback($assertIndex(0)); // Then the type itself $this->type->expects($this->once()) ->method('finishView') ->with($view, $form, $options) - ->will($this->returnCallback($assertIndex(1))); + ->willReturnCallback($assertIndex(1)); // Then its extensions $this->extension1->expects($this->once()) ->method('finishView') ->with($view, $form, $options) - ->will($this->returnCallback($assertIndex(2))); + ->willReturnCallback($assertIndex(2)); $this->extension2->expects($this->once()) ->method('finishView') ->with($view, $form, $options) - ->will($this->returnCallback($assertIndex(3))); + ->willReturnCallback($assertIndex(3)); $this->resolvedType->finishView($view, $form, $options); } diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 32c21c8432b7..f88902dc8ced 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -731,7 +731,7 @@ public function testCreateView() $type->expects($this->once()) ->method('createView') ->with($form) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $form->createView()); } @@ -748,12 +748,12 @@ public function testCreateViewWithParent() $parentType->expects($this->once()) ->method('createView') - ->will($this->returnValue($parentView)); + ->willReturn($parentView); $type->expects($this->once()) ->method('createView') ->with($form, $parentView) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $form->createView()); } @@ -768,7 +768,7 @@ public function testCreateViewWithExplicitParent() $type->expects($this->once()) ->method('createView') ->with($form, $parentView) - ->will($this->returnValue($view)); + ->willReturn($view); $this->assertSame($view, $form->createView($parentView)); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php index fb82dae768b4..caf202992700 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php @@ -172,7 +172,7 @@ protected function createMockGuesser($path, $mimeType) ->expects($this->once()) ->method('guess') ->with($this->equalTo($path)) - ->will($this->returnValue($mimeType)) + ->willReturn($mimeType) ; return $guesser; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php index 68daa4e5cb59..d7a324fc205b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php @@ -79,7 +79,7 @@ public function testWriteSession() ->expects($this->once()) ->method('set') ->with(self::PREFIX.'id', 'data', 0, $this->equalTo(time() + self::TTL, 2)) - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($this->storage->write('id', 'data')); @@ -91,7 +91,7 @@ public function testDestroySession() ->expects($this->once()) ->method('delete') ->with(self::PREFIX.'id') - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($this->storage->destroy('id')); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index 813337349f22..c3deb7aed8fb 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -66,7 +66,7 @@ public function testCloseSession() $this->memcached ->expects($this->once()) ->method('quit') - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($this->storage->close()); @@ -89,7 +89,7 @@ public function testWriteSession() ->expects($this->once()) ->method('set') ->with(self::PREFIX.'id', 'data', $this->equalTo(time() + self::TTL, 2)) - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($this->storage->write('id', 'data')); @@ -101,7 +101,7 @@ public function testDestroySession() ->expects($this->once()) ->method('delete') ->with(self::PREFIX.'id') - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($this->storage->destroy('id')); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 6f2742ca70e5..5ce6a9e5a664 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -95,7 +95,7 @@ public function testRead() $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); // defining the timeout before the actual method call // allows to test for "greater than" values in the $criteria @@ -103,7 +103,7 @@ public function testRead() $collection->expects($this->once()) ->method('findOne') - ->will($this->returnCallback(function ($criteria) use ($testTimeout) { + ->willReturnCallback(function ($criteria) use ($testTimeout) { $this->assertArrayHasKey($this->options['id_field'], $criteria); $this->assertEquals($criteria[$this->options['id_field']], 'foo'); @@ -131,7 +131,7 @@ public function testRead() } return $fields; - })); + }); $this->assertEquals('bar', $this->storage->read('foo')); } @@ -143,7 +143,7 @@ public function testWrite() $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $data = []; @@ -151,7 +151,7 @@ public function testWrite() $collection->expects($this->once()) ->method($methodName) - ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { + ->willReturnCallback(function ($criteria, $updateData, $options) use (&$data) { $this->assertEquals([$this->options['id_field'] => 'foo'], $criteria); if (phpversion('mongodb')) { @@ -161,7 +161,7 @@ public function testWrite() } $data = $updateData['$set']; - })); + }); $expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime'); $this->assertTrue($this->storage->write('foo', 'bar')); @@ -197,7 +197,7 @@ public function testWriteWhenUsingExpiresField() $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $data = []; @@ -205,7 +205,7 @@ public function testWriteWhenUsingExpiresField() $collection->expects($this->once()) ->method($methodName) - ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { + ->willReturnCallback(function ($criteria, $updateData, $options) use (&$data) { $this->assertEquals([$this->options['id_field'] => 'foo'], $criteria); if (phpversion('mongodb')) { @@ -215,7 +215,7 @@ public function testWriteWhenUsingExpiresField() } $data = $updateData['$set']; - })); + }); $this->assertTrue($this->storage->write('foo', 'bar')); @@ -237,7 +237,7 @@ public function testReplaceSessionData() $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $data = []; @@ -245,9 +245,9 @@ public function testReplaceSessionData() $collection->expects($this->exactly(2)) ->method($methodName) - ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) { + ->willReturnCallback(function ($criteria, $updateData, $options) use (&$data) { $data = $updateData; - })); + }); $this->storage->write('foo', 'bar'); $this->storage->write('foo', 'foobar'); @@ -266,7 +266,7 @@ public function testDestroy() $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove'; @@ -284,13 +284,13 @@ public function testGc() $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) - ->will($this->returnValue($collection)); + ->willReturn($collection); $methodName = phpversion('mongodb') ? 'deleteMany' : 'remove'; $collection->expects($this->once()) ->method($methodName) - ->will($this->returnCallback(function ($criteria) { + ->willReturnCallback(function ($criteria) { if (phpversion('mongodb')) { $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$lt']); $this->assertGreaterThanOrEqual(time() - 1, round((string) $criteria[$this->options['expiry_field']]['$lt'] / 1000)); @@ -298,7 +298,7 @@ public function testGc() $this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$lt']); $this->assertGreaterThanOrEqual(time() - 1, $criteria[$this->options['expiry_field']]['$lt']->sec); } - })); + }); $this->assertTrue($this->storage->gc(1)); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 901078478b4d..f0914eb43d08 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -147,7 +147,7 @@ public function testReadConvertsStreamToString() $stream = $this->createStream($content); $pdo->prepareResult->expects($this->once())->method('fetchAll') - ->will($this->returnValue([[$stream, 42, time()]])); + ->willReturn([[$stream, 42, time()]]); $storage = new PdoSessionHandler($pdo); $result = $storage->read('foo'); @@ -177,14 +177,14 @@ public function testReadLockedConvertsStreamToString() $exception = null; $selectStmt->expects($this->atLeast(2))->method('fetchAll') - ->will($this->returnCallback(function () use (&$exception, $stream) { + ->willReturnCallback(function () use (&$exception, $stream) { return $exception ? [[$stream, 42, time()]] : []; - })); + }); $insertStmt->expects($this->once())->method('execute') - ->will($this->returnCallback(function () use (&$exception) { + ->willReturnCallback(function () use (&$exception) { throw $exception = new \PDOException('', '23'); - })); + }); $storage = new PdoSessionHandler($pdo); $result = $storage->read('foo'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php index 898a7d11a5ae..b89454f87f4e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/WriteCheckSessionHandlerTest.php @@ -30,7 +30,7 @@ public function test() ->expects($this->once()) ->method('close') ->with() - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($writeCheckSessionHandler->close()); @@ -45,7 +45,7 @@ public function testWrite() ->expects($this->once()) ->method('write') ->with('foo', 'bar') - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertTrue($writeCheckSessionHandler->write('foo', 'bar')); @@ -60,7 +60,7 @@ public function testSkippedWrite() ->expects($this->once()) ->method('read') ->with('foo') - ->will($this->returnValue('bar')) + ->willReturn('bar') ; $wrappedSessionHandlerMock @@ -81,14 +81,14 @@ public function testNonSkippedWrite() ->expects($this->once()) ->method('read') ->with('foo') - ->will($this->returnValue('bar')) + ->willReturn('bar') ; $wrappedSessionHandlerMock ->expects($this->once()) ->method('write') ->with('foo', 'baZZZ') - ->will($this->returnValue(true)) + ->willReturn(true) ; $this->assertEquals('bar', $writeCheckSessionHandler->read('foo')); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php index 0459a8ce97d5..b6e0da99ddd6 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php @@ -50,7 +50,7 @@ public function testOpenTrue() { $this->mock->expects($this->once()) ->method('open') - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertFalse($this->proxy->isActive()); $this->proxy->open('name', 'id'); @@ -61,7 +61,7 @@ public function testOpenFalse() { $this->mock->expects($this->once()) ->method('open') - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertFalse($this->proxy->isActive()); $this->proxy->open('name', 'id'); @@ -72,7 +72,7 @@ public function testClose() { $this->mock->expects($this->once()) ->method('close') - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertFalse($this->proxy->isActive()); $this->proxy->close(); @@ -83,7 +83,7 @@ public function testCloseFalse() { $this->mock->expects($this->once()) ->method('close') - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertFalse($this->proxy->isActive()); $this->proxy->close(); diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php index de15c6f30ce0..41fe28507c8f 100644 --- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php @@ -87,7 +87,7 @@ public function testWarmupDoesNotCallWarmupOnOptionalWarmersWhenEnableOptionalWa $warmer ->expects($this->once()) ->method('isOptional') - ->will($this->returnValue(true)); + ->willReturn(true); $warmer ->expects($this->never()) ->method('warmUp'); diff --git a/src/Symfony/Component/HttpKernel/Tests/ClientTest.php b/src/Symfony/Component/HttpKernel/Tests/ClientTest.php index ac1c55ad54d3..86a51ce7651a 100644 --- a/src/Symfony/Component/HttpKernel/Tests/ClientTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/ClientTest.php @@ -157,7 +157,7 @@ public function testUploadedFileWhenSizeExceedsUploadMaxFileSize() $file->expects($this->once()) ->method('getSize') - ->will($this->returnValue(INF)) + ->willReturn(INF) ; $client->request('POST', '/', [], [$file]); diff --git a/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php b/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php index 6265f0275560..b20b12ab59ed 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php @@ -23,7 +23,7 @@ public function testLocate() ->expects($this->atLeastOnce()) ->method('locateResource') ->with('@BundleName/some/path', null, true) - ->will($this->returnValue('/bundle-name/some/path')); + ->willReturn('/bundle-name/some/path'); $locator = new FileLocator($kernel); $this->assertEquals('/bundle-name/some/path', $locator->locate('@BundleName/some/path')); diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php index 3f130db06500..098b89f9e125 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php @@ -26,11 +26,11 @@ public function testGetControllerService() $container->expects($this->once()) ->method('has') ->with('foo') - ->will($this->returnValue(true)); + ->willReturn(true); $container->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($this)) + ->willReturn($this) ; $resolver = $this->createControllerResolver(null, $container); @@ -51,12 +51,12 @@ public function testGetControllerInvokableService() $container->expects($this->once()) ->method('has') ->with('foo') - ->will($this->returnValue(true)) + ->willReturn(true) ; $container->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($invokableController)) + ->willReturn($invokableController) ; $resolver = $this->createControllerResolver(null, $container); @@ -77,12 +77,12 @@ public function testGetControllerInvokableServiceWithClassNameAsName() $container->expects($this->once()) ->method('has') ->with($className) - ->will($this->returnValue(true)) + ->willReturn(true) ; $container->expects($this->once()) ->method('get') ->with($className) - ->will($this->returnValue($invokableController)) + ->willReturn($invokableController) ; $resolver = $this->createControllerResolver(null, $container); @@ -100,7 +100,7 @@ public function testNonInstantiableController() $container->expects($this->once()) ->method('has') ->with(NonInstantiableController::class) - ->will($this->returnValue(false)) + ->willReturn(false) ; $resolver = $this->createControllerResolver(null, $container); @@ -122,19 +122,19 @@ public function testNonConstructController() $container->expects($this->at(0)) ->method('has') ->with(ImpossibleConstructController::class) - ->will($this->returnValue(true)) + ->willReturn(true) ; $container->expects($this->at(1)) ->method('has') ->with(ImpossibleConstructController::class) - ->will($this->returnValue(false)) + ->willReturn(false) ; $container->expects($this->atLeastOnce()) ->method('getRemovedIds') ->with() - ->will($this->returnValue([ImpossibleConstructController::class => true])) + ->willReturn([ImpossibleConstructController::class => true]) ; $resolver = $this->createControllerResolver(null, $container); @@ -162,12 +162,12 @@ public function testNonInstantiableControllerWithCorrespondingService() $container->expects($this->atLeastOnce()) ->method('has') ->with(NonInstantiableController::class) - ->will($this->returnValue(true)) + ->willReturn(true) ; $container->expects($this->atLeastOnce()) ->method('get') ->with(NonInstantiableController::class) - ->will($this->returnValue($service)) + ->willReturn($service) ; $resolver = $this->createControllerResolver(null, $container); @@ -189,13 +189,13 @@ public function testExceptionWhenUsingRemovedControllerService() $container->expects($this->at(0)) ->method('has') ->with('app.my_controller') - ->will($this->returnValue(false)) + ->willReturn(false) ; $container->expects($this->atLeastOnce()) ->method('getRemovedIds') ->with() - ->will($this->returnValue(['app.my_controller' => true])) + ->willReturn(['app.my_controller' => true]) ; $resolver = $this->createControllerResolver(null, $container); @@ -215,12 +215,12 @@ public function testExceptionWhenUsingControllerWithoutAnInvokeMethod() $container->expects($this->once()) ->method('has') ->with('app.my_controller') - ->will($this->returnValue(true)) + ->willReturn(true) ; $container->expects($this->once()) ->method('get') ->with('app.my_controller') - ->will($this->returnValue(new ImpossibleConstructController('toto', 'controller'))) + ->willReturn(new ImpossibleConstructController('toto', 'controller')) ; $resolver = $this->createControllerResolver(null, $container); diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php index 728382ad2b1e..6a28eab26bb5 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php @@ -226,7 +226,7 @@ public function testGetVariadicArguments() public function testCreateControllerCanReturnAnyCallable() { $mock = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolver')->setMethods(['createController'])->getMock(); - $mock->expects($this->once())->method('createController')->will($this->returnValue('Symfony\Component\HttpKernel\Tests\Controller\some_controller_function')); + $mock->expects($this->once())->method('createController')->willReturn('Symfony\Component\HttpKernel\Tests\Controller\some_controller_function'); $request = Request::create('/'); $request->attributes->set('_controller', 'foobar'); diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php index 90151ae44afd..ace4628e09f9 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php @@ -23,8 +23,8 @@ public function testCollectWithUnexpectedFormat() ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); - $logger->expects($this->once())->method('countErrors')->will($this->returnValue('foo')); - $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue([])); + $logger->expects($this->once())->method('countErrors')->willReturn('foo'); + $logger->expects($this->exactly(2))->method('getLogs')->willReturn([]); $c = new LoggerDataCollector($logger, __DIR__.'/'); $c->lateCollect(); @@ -50,8 +50,8 @@ public function testCollect($nb, $logs, $expectedLogs, $expectedDeprecationCount ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); - $logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb)); - $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue($logs)); + $logger->expects($this->once())->method('countErrors')->willReturn($nb); + $logger->expects($this->exactly(2))->method('getLogs')->willReturn($logs); $c = new LoggerDataCollector($logger); $c->lateCollect(); diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php index 793fbd319f94..6756f3de4264 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php @@ -44,7 +44,7 @@ public function testCollect() $this->assertEquals(0, $c->getStartTime()); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock(); - $kernel->expects($this->once())->method('getStartTime')->will($this->returnValue(123456)); + $kernel->expects($this->once())->method('getStartTime')->willReturn(123456); $c = new TimeDataCollector($kernel); $request = new Request(); diff --git a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php index 8b8e91aeb474..60ad1b89c4df 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -49,7 +49,7 @@ public function testStopwatchCheckControllerOnRequestEvent() ->getMock(); $stopwatch->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(false)); + ->willReturn(false); $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch); @@ -65,7 +65,7 @@ public function testStopwatchStopControllerOnRequestEvent() ->getMock(); $stopwatch->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(true)); + ->willReturn(true); $stopwatch->expects($this->once()) ->method('stop'); $stopwatch->expects($this->once()) @@ -112,9 +112,9 @@ public function testListenerCanRemoveItselfWhenExecuted() protected function getHttpKernel($dispatcher, $controller) { $controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock(); - $controllerResolver->expects($this->once())->method('getController')->will($this->returnValue($controller)); + $controllerResolver->expects($this->once())->method('getController')->willReturn($controller); $argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock(); - $argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue([])); + $argumentResolver->expects($this->once())->method('getArguments')->willReturn([]); return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver); } diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php index 95baaa54c133..953dc65cdf73 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php @@ -25,14 +25,14 @@ class LazyLoadingFragmentHandlerTest extends TestCase public function testRenderWithLegacyMapping() { $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock(); - $renderer->expects($this->once())->method('getName')->will($this->returnValue('foo')); - $renderer->expects($this->any())->method('render')->will($this->returnValue(new Response())); + $renderer->expects($this->once())->method('getName')->willReturn('foo'); + $renderer->expects($this->any())->method('render')->willReturn(new Response()); $requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock(); - $requestStack->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/'))); + $requestStack->expects($this->any())->method('getCurrentRequest')->willReturn(Request::create('/')); $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); - $container->expects($this->once())->method('get')->will($this->returnValue($renderer)); + $container->expects($this->once())->method('get')->willReturn($renderer); $handler = new LazyLoadingFragmentHandler($container, $requestStack, false); $handler->addRendererService('foo', 'foo'); @@ -46,15 +46,15 @@ public function testRenderWithLegacyMapping() public function testRender() { $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock(); - $renderer->expects($this->once())->method('getName')->will($this->returnValue('foo')); - $renderer->expects($this->any())->method('render')->will($this->returnValue(new Response())); + $renderer->expects($this->once())->method('getName')->willReturn('foo'); + $renderer->expects($this->any())->method('render')->willReturn(new Response()); $requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock(); - $requestStack->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/'))); + $requestStack->expects($this->any())->method('getCurrentRequest')->willReturn(Request::create('/')); $container = $this->getMockBuilder('Psr\Container\ContainerInterface')->getMock(); $container->expects($this->once())->method('has')->with('foo')->willReturn(true); - $container->expects($this->once())->method('get')->will($this->returnValue($renderer)); + $container->expects($this->once())->method('get')->willReturn($renderer); $handler = new LazyLoadingFragmentHandler($container, $requestStack, false); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php index b4ea2f955bb5..4ab0a8fb1ea6 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php @@ -77,7 +77,7 @@ protected function getGetResponseEventMock(Request $request) $event->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)); + ->willReturn($request); return $event; } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php index d9e261d35af5..44af0149f738 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php @@ -94,7 +94,7 @@ public function testConsoleEvent() $dispatcher = new EventDispatcher(); $listener = new DebugHandlersListener(null); $app = $this->getMockBuilder('Symfony\Component\Console\Application')->getMock(); - $app->expects($this->once())->method('getHelperSet')->will($this->returnValue(new HelperSet())); + $app->expects($this->once())->method('getHelperSet')->willReturn(new HelperSet()); $command = new Command(__FUNCTION__); $command->setApplication($app); $event = new ConsoleEvent($command, new ArgvInput(), new ConsoleOutput()); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index c4e8cd505cbf..fca60f1927a2 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -112,9 +112,9 @@ public function testSubRequestFormat() $listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock()); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { + $kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) { return new Response($request->getRequestFormat()); - })); + }); $request = Request::create('/'); $request->setRequestFormat('xml'); @@ -130,9 +130,9 @@ public function testCSPHeaderIsRemoved() { $dispatcher = new EventDispatcher(); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { + $kernel->expects($this->once())->method('handle')->willReturnCallback(function (Request $request) { return new Response($request->getRequestFormat()); - })); + }); $listener = new ExceptionListener('foo', $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(), true); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index 1cf4b72c69d7..5f96f7f7c660 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -55,7 +55,7 @@ public function testLocaleSetForRoutingContext() $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock(); - $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); + $router->expects($this->once())->method('getContext')->willReturn($context); $request = Request::create('/'); @@ -71,12 +71,12 @@ public function testRouterResetWithParentRequestOnKernelFinishRequest() $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock(); - $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); + $router->expects($this->once())->method('getContext')->willReturn($context); $parentRequest = Request::create('/'); $parentRequest->setLocale('es'); - $this->requestStack->expects($this->once())->method('getParentRequest')->will($this->returnValue($parentRequest)); + $this->requestStack->expects($this->once())->method('getParentRequest')->willReturn($parentRequest); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\FinishRequestEvent')->disableOriginalConstructor()->getMock(); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php index 392aa2fc3581..7808578882fc 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php @@ -36,7 +36,7 @@ public function testKernelTerminate() $profiler->expects($this->once()) ->method('collect') - ->will($this->returnValue($profile)); + ->willReturn($profile); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index 218af8d36e29..33f6ab9594a9 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -49,7 +49,7 @@ public function testPort($defaultHttpPort, $defaultHttpsPort, $uri, $expectedHtt $context->setHttpsPort($defaultHttpsPort); $urlMatcher->expects($this->any()) ->method('getContext') - ->will($this->returnValue($context)); + ->willReturn($context); $listener = new RouterListener($urlMatcher, $this->requestStack); $event = $this->createGetResponseEventForUri($uri); @@ -102,7 +102,7 @@ public function testRequestMatcher() $requestMatcher->expects($this->once()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue([])); + ->willReturn([]); $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext()); $listener->onKernelRequest($event); @@ -118,7 +118,7 @@ public function testSubRequestWithDifferentMethod() $requestMatcher->expects($this->any()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue([])); + ->willReturn([]); $context = new RequestContext(); @@ -143,7 +143,7 @@ public function testLoggingParameter($parameter, $log, $parameters) $requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock(); $requestMatcher->expects($this->once()) ->method('matchRequest') - ->will($this->returnValue($parameter)); + ->willReturn($parameter); $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $logger->expects($this->once()) diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php index f261f2ed15a6..7187c7d1f625 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php @@ -47,7 +47,7 @@ protected function setUp() $this->session = $this->getSession(); $this->listener->expects($this->any()) ->method('getSession') - ->will($this->returnValue($this->session)); + ->willReturn($this->session); } public function testShouldSaveMasterRequestSession() @@ -183,28 +183,28 @@ private function sessionHasBeenStarted() { $this->session->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(true)); + ->willReturn(true); } private function sessionHasNotBeenStarted() { $this->session->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(false)); + ->willReturn(false); } private function sessionIsEmpty() { $this->session->expects($this->once()) ->method('isEmpty') - ->will($this->returnValue(true)); + ->willReturn(true); } private function fixSessionId($sessionId) { $this->session->expects($this->any()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); } private function getSession() @@ -214,7 +214,7 @@ private function getSession() ->getMock(); // set return value for getName() - $mock->expects($this->any())->method('getName')->will($this->returnValue('MOCKSESSID')); + $mock->expects($this->any())->method('getName')->willReturn('MOCKSESSID'); return $mock; } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php index c1d56ec85d72..77c2c1c69452 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php @@ -113,6 +113,6 @@ private function setMasterRequest($request) $this->requestStack ->expects($this->any()) ->method('getParentRequest') - ->will($this->returnValue($request)); + ->willReturn($request); } } diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php index 8829393ea4e5..06ce785ea609 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php @@ -32,7 +32,7 @@ protected function setUp() $this->requestStack ->expects($this->any()) ->method('getCurrentRequest') - ->will($this->returnValue(Request::create('/'))) + ->willReturn(Request::create('/')) ; } @@ -79,7 +79,7 @@ protected function getHandler($returnValue, $arguments = []) $renderer ->expects($this->any()) ->method('getName') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $e = $renderer ->expects($this->any()) diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php index 11adf74c2931..b2a2dcaef630 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php @@ -64,9 +64,9 @@ public function testRenderWithObjectsAsAttributesPassedAsObjectsInTheControllerL $resolver ->expects($this->once()) ->method('getController') - ->will($this->returnValue(function (\stdClass $object, Bar $object1) { + ->willReturn(function (\stdClass $object, Bar $object1) { return new Response($object1->getBar()); - })) + }) ; $kernel = new HttpKernel(new EventDispatcher(), $resolver, new RequestStack()); @@ -85,9 +85,9 @@ public function testRenderWithObjectsAsAttributesPassedAsObjectsInTheController( $resolver ->expects($this->once()) ->method('getController') - ->will($this->returnValue(function (\stdClass $object, Bar $object1) { + ->willReturn(function (\stdClass $object, Bar $object1) { return new Response($object1->getBar()); - })) + }) ; $kernel = new HttpKernel(new EventDispatcher(), $resolver, new RequestStack(), new ArgumentResolver()); @@ -162,18 +162,18 @@ public function testExceptionInSubRequestsDoesNotMangleOutputBuffers() $controllerResolver ->expects($this->once()) ->method('getController') - ->will($this->returnValue(function () { + ->willReturn(function () { ob_start(); echo 'bar'; throw new \RuntimeException(); - })) + }) ; $argumentResolver = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface')->getMock(); $argumentResolver ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue([])) + ->willReturn([]) ; $kernel = new HttpKernel(new EventDispatcher(), $controllerResolver, new RequestStack(), $argumentResolver); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php index ccc3eecfaf8c..1fc8da8e2453 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php @@ -229,7 +229,7 @@ protected function getCache($request, $response) $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; if (\is_array($response)) { $cache->expects($this->any()) @@ -239,7 +239,7 @@ protected function getCache($request, $response) } else { $cache->expects($this->any()) ->method('handle') - ->will($this->returnValue($response)) + ->willReturn($response) ; } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php index 2fc0bb9660dd..79ed48cd00f7 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php @@ -196,7 +196,7 @@ protected function getCache($request, $response) $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; if (\is_array($response)) { $cache->expects($this->any()) @@ -206,7 +206,7 @@ protected function getCache($request, $response) } else { $cache->expects($this->any()) ->method('handle') - ->will($this->returnValue($response)) + ->willReturn($response) ; } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php index 939ecc044635..01e32898e297 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php @@ -363,13 +363,13 @@ private function getHttpKernel(EventDispatcherInterface $eventDispatcher, $contr $controllerResolver ->expects($this->any()) ->method('getController') - ->will($this->returnValue($controller)); + ->willReturn($controller); $argumentResolver = $this->getMockBuilder(ArgumentResolverInterface::class)->getMock(); $argumentResolver ->expects($this->any()) ->method('getArguments') - ->will($this->returnValue($arguments)); + ->willReturn($arguments); return new HttpKernel($eventDispatcher, $controllerResolver, $requestStack, $argumentResolver); } diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 208e11e182d6..04d74ae0a319 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -110,7 +110,7 @@ public function testBootSetsTheContainerToTheBundles() $kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'getBundles']); $kernel->expects($this->once()) ->method('getBundles') - ->will($this->returnValue([$bundle])); + ->willReturn([$bundle]); $kernel->boot(); } @@ -167,16 +167,16 @@ public function testEnvParametersResourceIsAdded() ->getMock(); $kernel->expects($this->any()) ->method('getContainerBuilder') - ->will($this->returnValue($container)); + ->willReturn($container); $kernel->expects($this->any()) ->method('prepareContainer') - ->will($this->returnValue(null)); + ->willReturn(null); $kernel->expects($this->any()) ->method('getCacheDir') - ->will($this->returnValue(sys_get_temp_dir())); + ->willReturn(sys_get_temp_dir()); $kernel->expects($this->any()) ->method('getLogDir') - ->will($this->returnValue(sys_get_temp_dir())); + ->willReturn(sys_get_temp_dir()); $reflection = new \ReflectionClass(\get_class($kernel)); $method = $reflection->getMethod('buildContainer'); @@ -226,7 +226,7 @@ public function testShutdownGivesNullContainerToAllBundles() $kernel = $this->getKernel(['getBundles']); $kernel->expects($this->any()) ->method('getBundles') - ->will($this->returnValue([$bundle])); + ->willReturn([$bundle]); $kernel->boot(); $kernel->shutdown(); @@ -249,7 +249,7 @@ public function testHandleCallsHandleOnHttpKernel() $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->once()) ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); + ->willReturn($httpKernelMock); $kernel->handle($request, $type, $catch); } @@ -267,7 +267,7 @@ public function testHandleBootsTheKernel() $kernel = $this->getKernel(['getHttpKernel', 'boot']); $kernel->expects($this->once()) ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); + ->willReturn($httpKernelMock); $kernel->expects($this->once()) ->method('boot'); @@ -421,7 +421,7 @@ public function testLocateResourceThrowsExceptionWhenResourceDoesNotExist() $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')])) + ->willReturn([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')]) ; $kernel->locateResource('@Bundle1Bundle/config/routing.xml'); @@ -433,7 +433,7 @@ public function testLocateResourceReturnsTheFirstThatMatches() $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')])) + ->willReturn([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')]) ; $this->assertEquals(__DIR__.'/Fixtures/Bundle1Bundle/foo.txt', $kernel->locateResource('@Bundle1Bundle/foo.txt')); @@ -451,7 +451,7 @@ public function testLocateResourceReturnsTheFirstThatMatchesWithParent() $kernel ->expects($this->exactly(2)) ->method('getBundle') - ->will($this->returnValue([$child, $parent])) + ->willReturn([$child, $parent]) ; $this->assertEquals(__DIR__.'/Fixtures/Bundle2Bundle/foo.txt', $kernel->locateResource('@ParentAABundle/foo.txt')); @@ -470,7 +470,7 @@ public function testLocateResourceReturnsAllMatches() $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue([$child, $parent])) + ->willReturn([$child, $parent]) ; $this->assertEquals([ @@ -488,10 +488,10 @@ public function testLocateResourceReturnsAllMatchesBis() $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue([ + ->willReturn([ $this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle'), $this->getBundle(__DIR__.'/Foobar'), - ])) + ]) ; $this->assertEquals( @@ -506,7 +506,7 @@ public function testLocateResourceIgnoresDirOnNonResource() $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')])) + ->willReturn([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle')]) ; $this->assertEquals( @@ -521,7 +521,7 @@ public function testLocateResourceReturnsTheDirOneForResources() $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')])) + ->willReturn([$this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')]) ; $this->assertEquals( @@ -539,7 +539,7 @@ public function testLocateResourceReturnsTheDirOneForResourcesAndBundleOnes() $kernel ->expects($this->once()) ->method('getBundle') - ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')])) + ->willReturn([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')]) ; $this->assertEquals([ @@ -561,7 +561,7 @@ public function testLocateResourceOverrideBundleAndResourcesFolders() $kernel ->expects($this->exactly(4)) ->method('getBundle') - ->will($this->returnValue([$child, $parent])) + ->willReturn([$child, $parent]) ; $this->assertEquals([ @@ -596,7 +596,7 @@ public function testLocateResourceOnDirectories() $kernel ->expects($this->exactly(2)) ->method('getBundle') - ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')])) + ->willReturn([$this->getBundle(__DIR__.'/Fixtures/FooBundle', null, null, 'FooBundle')]) ; $this->assertEquals( @@ -612,7 +612,7 @@ public function testLocateResourceOnDirectories() $kernel ->expects($this->exactly(2)) ->method('getBundle') - ->will($this->returnValue([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')])) + ->willReturn([$this->getBundle(__DIR__.'/Fixtures/Bundle1Bundle', null, null, 'Bundle1Bundle')]) ; $this->assertEquals( @@ -638,7 +638,7 @@ public function testInitializeBundles() $kernel ->expects($this->once()) ->method('registerBundles') - ->will($this->returnValue([$parent, $child])) + ->willReturn([$parent, $child]) ; $kernel->boot(); @@ -660,7 +660,7 @@ public function testInitializeBundlesSupportInheritanceCascade() $kernel ->expects($this->once()) ->method('registerBundles') - ->will($this->returnValue([$grandparent, $parent, $child])) + ->willReturn([$grandparent, $parent, $child]) ; $kernel->boot(); @@ -696,7 +696,7 @@ public function testInitializeBundlesSupportsArbitraryBundleRegistrationOrder() $kernel ->expects($this->once()) ->method('registerBundles') - ->will($this->returnValue([$parent, $grandparent, $child])) + ->willReturn([$parent, $grandparent, $child]) ; $kernel->boot(); @@ -785,7 +785,7 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface() $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->exactly(2)) ->method('getHttpKernel') - ->will($this->returnValue($httpKernelMock)); + ->willReturn($httpKernelMock); $kernel->boot(); $kernel->terminate(Request::create('/'), new Response()); @@ -938,19 +938,19 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu $bundle ->expects($this->any()) ->method('getName') - ->will($this->returnValue(null === $bundleName ? \get_class($bundle) : $bundleName)) + ->willReturn(null === $bundleName ? \get_class($bundle) : $bundleName) ; $bundle ->expects($this->any()) ->method('getPath') - ->will($this->returnValue($dir)) + ->willReturn($dir) ; $bundle ->expects($this->any()) ->method('getParent') - ->will($this->returnValue($parent)) + ->willReturn($parent) ; return $bundle; @@ -976,7 +976,7 @@ protected function getKernel(array $methods = [], array $bundles = []) ; $kernel->expects($this->any()) ->method('registerBundles') - ->will($this->returnValue($bundles)) + ->willReturn($bundles) ; $p = new \ReflectionProperty($kernel, 'rootDir'); $p->setAccessible(true); diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php index 17865203f2c9..3a5a8ade5415 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php @@ -149,7 +149,7 @@ public function testObjectCastToString() } $dummy->expects($this->atLeastOnce()) ->method('__toString') - ->will($this->returnValue('DUMMY')); + ->willReturn('DUMMY'); $this->logger->warning($dummy); diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php index 766611ed027d..3357b039ea81 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php @@ -72,7 +72,7 @@ public function testForwardCallToRead() $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'root') - ->will($this->returnValue(self::$data)); + ->willReturn(self::$data); $this->assertSame(self::$data, $this->reader->read(self::RES_DIR, 'root')); } @@ -82,12 +82,12 @@ public function testReadEntireDataFileIfNoIndicesGiven() $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(self::$data)); + ->willReturn(self::$data); $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'root') - ->will($this->returnValue(self::$fallbackData)); + ->willReturn(self::$fallbackData); $this->assertSame(self::$mergedData, $this->reader->readEntry(self::RES_DIR, 'en', [])); } @@ -97,7 +97,7 @@ public function testReadExistingEntry() $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'root') - ->will($this->returnValue(self::$data)); + ->willReturn(self::$data); $this->assertSame('Bar', $this->reader->readEntry(self::RES_DIR, 'root', ['Entries', 'Foo'])); } @@ -110,7 +110,7 @@ public function testReadNonExistingEntry() $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'root') - ->will($this->returnValue(self::$data)); + ->willReturn(self::$data); $this->reader->readEntry(self::RES_DIR, 'root', ['Entries', 'NonExisting']); } @@ -120,12 +120,12 @@ public function testFallbackIfEntryDoesNotExist() $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(self::$data)); + ->willReturn(self::$data); $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(self::$fallbackData)); + ->willReturn(self::$fallbackData); $this->assertSame('Lah', $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam'])); } @@ -138,7 +138,7 @@ public function testDontFallbackIfEntryDoesNotExistAndFallbackDisabled() $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(self::$data)); + ->willReturn(self::$data); $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam'], false); } @@ -153,7 +153,7 @@ public function testFallbackIfLocaleDoesNotExist() $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(self::$fallbackData)); + ->willReturn(self::$fallbackData); $this->assertSame('Lah', $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam'])); } @@ -193,17 +193,17 @@ public function testMergeDataWithFallbackData($childData, $parentData, $result) $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue($childData)); + ->willReturn($childData); $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'root') - ->will($this->returnValue($parentData)); + ->willReturn($parentData); } else { $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue($childData)); + ->willReturn($childData); } $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en', [], true)); @@ -217,7 +217,7 @@ public function testDontMergeDataIfFallbackDisabled($childData, $parentData, $re $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue($childData)); + ->willReturn($childData); $this->assertSame($childData, $this->reader->readEntry(self::RES_DIR, 'en_GB', [], false)); } @@ -231,17 +231,17 @@ public function testMergeExistingEntryWithExistingFallbackEntry($childData, $par $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(['Foo' => ['Bar' => $childData]])); + ->willReturn(['Foo' => ['Bar' => $childData]]); $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'root') - ->will($this->returnValue(['Foo' => ['Bar' => $parentData]])); + ->willReturn(['Foo' => ['Bar' => $parentData]]); } else { $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(['Foo' => ['Bar' => $childData]])); + ->willReturn(['Foo' => ['Bar' => $childData]]); } $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en', ['Foo', 'Bar'], true)); @@ -255,12 +255,12 @@ public function testMergeNonExistingEntryWithExistingFallbackEntry($childData, $ $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(['Foo' => 'Baz'])); + ->willReturn(['Foo' => 'Baz']); $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(['Foo' => ['Bar' => $parentData]])); + ->willReturn(['Foo' => ['Bar' => $parentData]]); $this->assertSame($parentData, $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true)); } @@ -274,17 +274,17 @@ public function testMergeExistingEntryWithNonExistingFallbackEntry($childData, $ $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(['Foo' => ['Bar' => $childData]])); + ->willReturn(['Foo' => ['Bar' => $childData]]); $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(['Foo' => 'Bar'])); + ->willReturn(['Foo' => 'Bar']); } else { $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(['Foo' => ['Bar' => $childData]])); + ->willReturn(['Foo' => ['Bar' => $childData]]); } $this->assertSame($childData, $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true)); @@ -298,12 +298,12 @@ public function testFailIfEntryFoundNeitherInParentNorChild() $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(['Foo' => 'Baz'])); + ->willReturn(['Foo' => 'Baz']); $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(['Foo' => 'Bar'])); + ->willReturn(['Foo' => 'Bar']); $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true); } @@ -320,17 +320,17 @@ public function testMergeTraversables($childData, $parentData, $result) $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(['Foo' => ['Bar' => $childData]])); + ->willReturn(['Foo' => ['Bar' => $childData]]); $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'en') - ->will($this->returnValue(['Foo' => ['Bar' => $parentData]])); + ->willReturn(['Foo' => ['Bar' => $parentData]]); } else { $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(['Foo' => ['Bar' => $childData]])); + ->willReturn(['Foo' => ['Bar' => $childData]]); } $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true)); @@ -347,18 +347,18 @@ public function testFollowLocaleAliases($childData, $parentData, $result) $this->readerImpl->expects($this->at(0)) ->method('read') ->with(self::RES_DIR, 'ro_MD') - ->will($this->returnValue(['Foo' => ['Bar' => $childData]])); + ->willReturn(['Foo' => ['Bar' => $childData]]); // Read fallback locale of aliased locale ("ro_MD" -> "ro") $this->readerImpl->expects($this->at(1)) ->method('read') ->with(self::RES_DIR, 'ro') - ->will($this->returnValue(['Foo' => ['Bar' => $parentData]])); + ->willReturn(['Foo' => ['Bar' => $parentData]]); } else { $this->readerImpl->expects($this->once()) ->method('read') ->with(self::RES_DIR, 'ro_MD') - ->will($this->returnValue(['Foo' => ['Bar' => $childData]])); + ->willReturn(['Foo' => ['Bar' => $childData]]); } $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'mo', ['Foo', 'Bar'], true)); diff --git a/src/Symfony/Component/Ldap/Tests/LdapClientTest.php b/src/Symfony/Component/Ldap/Tests/LdapClientTest.php index 63b3379d25e1..95373e92b14e 100644 --- a/src/Symfony/Component/Ldap/Tests/LdapClientTest.php +++ b/src/Symfony/Component/Ldap/Tests/LdapClientTest.php @@ -70,7 +70,7 @@ public function testLdapFind() $collection ->expects($this->once()) ->method('getIterator') - ->will($this->returnValue(new \ArrayIterator([ + ->willReturn(new \ArrayIterator([ new Entry('cn=qux,dc=foo,dc=com', [ 'cn' => ['qux'], 'dc' => ['com', 'foo'], @@ -81,13 +81,13 @@ public function testLdapFind() 'dc' => ['com', 'foo'], 'givenName' => ['Baz'], ]), - ]))) + ])) ; $query = $this->getMockBuilder(QueryInterface::class)->getMock(); $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($collection)) + ->willReturn($collection) ; $this->ldap ->expects($this->once()) diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php index acc845222587..0d6961c267ac 100644 --- a/src/Symfony/Component/Ldap/Tests/LdapTest.php +++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php @@ -42,7 +42,7 @@ public function testLdapBind() $this->adapter ->expects($this->once()) ->method('getConnection') - ->will($this->returnValue($connection)) + ->willReturn($connection) ; $this->ldap->bind('foo', 'bar'); } diff --git a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php index 4b0376ff4ef5..ff0ea508e50f 100644 --- a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php @@ -27,7 +27,7 @@ public function testProcessFailedExceptionThrowsException() $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful'])->setConstructorArgs(['php'])->getMock(); $process->expects($this->once()) ->method('isSuccessful') - ->will($this->returnValue(true)); + ->willReturn(true); if (method_exists($this, 'expectException')) { $this->expectException(\InvalidArgumentException::class); @@ -55,31 +55,31 @@ public function testProcessFailedExceptionPopulatesInformationFromProcessOutput( $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled', 'getWorkingDirectory'])->setConstructorArgs([$cmd])->getMock(); $process->expects($this->once()) ->method('isSuccessful') - ->will($this->returnValue(false)); + ->willReturn(false); $process->expects($this->once()) ->method('getOutput') - ->will($this->returnValue($output)); + ->willReturn($output); $process->expects($this->once()) ->method('getErrorOutput') - ->will($this->returnValue($errorOutput)); + ->willReturn($errorOutput); $process->expects($this->once()) ->method('getExitCode') - ->will($this->returnValue($exitCode)); + ->willReturn($exitCode); $process->expects($this->once()) ->method('getExitCodeText') - ->will($this->returnValue($exitText)); + ->willReturn($exitText); $process->expects($this->once()) ->method('isOutputDisabled') - ->will($this->returnValue(false)); + ->willReturn(false); $process->expects($this->once()) ->method('getWorkingDirectory') - ->will($this->returnValue($workingDirectory)); + ->willReturn($workingDirectory); $exception = new ProcessFailedException($process); @@ -103,7 +103,7 @@ public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput() $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput', 'getWorkingDirectory'])->setConstructorArgs([$cmd])->getMock(); $process->expects($this->once()) ->method('isSuccessful') - ->will($this->returnValue(false)); + ->willReturn(false); $process->expects($this->never()) ->method('getOutput'); @@ -113,19 +113,19 @@ public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput() $process->expects($this->once()) ->method('getExitCode') - ->will($this->returnValue($exitCode)); + ->willReturn($exitCode); $process->expects($this->once()) ->method('getExitCodeText') - ->will($this->returnValue($exitText)); + ->willReturn($exitText); $process->expects($this->once()) ->method('isOutputDisabled') - ->will($this->returnValue(true)); + ->willReturn(true); $process->expects($this->once()) ->method('getWorkingDirectory') - ->will($this->returnValue($workingDirectory)); + ->willReturn($workingDirectory); $exception = new ProcessFailedException($process); diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php index 1aee259a76c8..b91d1e62ebb9 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php @@ -128,11 +128,11 @@ public function testSetValueCallsAdderAndRemoverForNestedCollections() $car->expects($this->any()) ->method('getStructure') - ->will($this->returnValue($structure)); + ->willReturn($structure); $structure->expects($this->at(0)) ->method('getAxes') - ->will($this->returnValue($axesBefore)); + ->willReturn($axesBefore); $structure->expects($this->at(1)) ->method('removeAxis') ->with('fourth'); @@ -158,7 +158,7 @@ public function testSetValueFailsIfNoAdderNorRemoverFound() $car->expects($this->any()) ->method('getAxes') - ->will($this->returnValue($axesBefore)); + ->willReturn($axesBefore); $this->propertyAccessor->setValue($car, 'axes', $axesAfter); } diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php index 657f361b4035..7726dc6fa89f 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -119,7 +119,7 @@ public function testLoad($className, $routeData = [], $methodArgs = []) $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue([$this->getAnnotatedRoute($routeData)])) + ->willReturn([$this->getAnnotatedRoute($routeData)]) ; $routeCollection = $this->loader->load($className); @@ -165,12 +165,12 @@ public function testClassRouteLoad() $this->reader ->expects($this->once()) ->method('getClassAnnotation') - ->will($this->returnValue($this->getAnnotatedRoute($classRouteData))) + ->willReturn($this->getAnnotatedRoute($classRouteData)) ; $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue([$this->getAnnotatedRoute($methodRouteData)])) + ->willReturn([$this->getAnnotatedRoute($methodRouteData)]) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass'); @@ -193,12 +193,12 @@ public function testInvokableClassRouteLoadWithMethodAnnotation() $this->reader ->expects($this->exactly(1)) ->method('getClassAnnotations') - ->will($this->returnValue([$this->getAnnotatedRoute($classRouteData)])) + ->willReturn([$this->getAnnotatedRoute($classRouteData)]) ; $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue([])) + ->willReturn([]) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); @@ -221,19 +221,19 @@ public function testInvokableClassRouteLoadWithClassAnnotation() $this->reader ->expects($this->exactly(1)) ->method('getClassAnnotation') - ->will($this->returnValue($this->getAnnotatedRoute($classRouteData))) + ->willReturn($this->getAnnotatedRoute($classRouteData)) ; $this->reader ->expects($this->exactly(1)) ->method('getClassAnnotations') - ->will($this->returnValue([$this->getAnnotatedRoute($classRouteData)])) + ->willReturn([$this->getAnnotatedRoute($classRouteData)]) ; $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue([])) + ->willReturn([]) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); @@ -263,12 +263,12 @@ public function testInvokableClassMultipleRouteLoad() $this->reader ->expects($this->exactly(1)) ->method('getClassAnnotations') - ->will($this->returnValue([$this->getAnnotatedRoute($classRouteData1), $this->getAnnotatedRoute($classRouteData2)])) + ->willReturn([$this->getAnnotatedRoute($classRouteData1), $this->getAnnotatedRoute($classRouteData2)]) ; $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue([])) + ->willReturn([]) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); @@ -304,12 +304,12 @@ public function testInvokableClassWithMethodRouteLoad() $this->reader ->expects($this->once()) ->method('getClassAnnotation') - ->will($this->returnValue($this->getAnnotatedRoute($classRouteData))) + ->willReturn($this->getAnnotatedRoute($classRouteData)) ; $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue([$this->getAnnotatedRoute($methodRouteData)])) + ->willReturn([$this->getAnnotatedRoute($methodRouteData)]) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); @@ -336,7 +336,7 @@ public function testDefaultRouteName() $this->reader ->expects($this->once()) ->method('getMethodAnnotations') - ->will($this->returnValue([$this->getAnnotatedRoute($methodRouteData)])) + ->willReturn([$this->getAnnotatedRoute($methodRouteData)]) ; $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\EncodingClass'); diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php index 9465ef05df23..df96a679e40f 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php @@ -34,13 +34,13 @@ public function testLoad() $this->reader ->expects($this->any()) ->method('getMethodAnnotations') - ->will($this->returnValue([])) + ->willReturn([]) ; $this->reader ->expects($this->any()) ->method('getClassAnnotations') - ->will($this->returnValue([])) + ->willReturn([]) ; $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses'); @@ -58,13 +58,13 @@ public function testLoadIgnoresHiddenDirectories() $this->reader ->expects($this->any()) ->method('getMethodAnnotations') - ->will($this->returnValue([])) + ->willReturn([]) ; $this->reader ->expects($this->any()) ->method('getClassAnnotations') - ->will($this->returnValue([])) + ->willReturn([]) ; $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses'); @@ -93,7 +93,7 @@ public function testLoadFileIfLocatedResourceIsFile() $this->reader ->expects($this->any()) ->method('getMethodAnnotations') - ->will($this->returnValue([])) + ->willReturn([]) ; $this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses/FooClass.php'); diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php index 43eb44e48df9..066b7c45f54e 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -62,7 +62,7 @@ public function testLoadVariadic() $route = new Route(['path' => '/path/to/{id}']); $this->reader->expects($this->once())->method('getClassAnnotation'); $this->reader->expects($this->once())->method('getMethodAnnotations') - ->will($this->returnValue([$route])); + ->willReturn([$route]); $this->loader->load(__DIR__.'/../Fixtures/OtherAnnotatedClasses/VariadicClass.php'); } diff --git a/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php index 89dcd5ba3f11..774e1a1fe575 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php @@ -89,7 +89,7 @@ public function testExceptionOnMethodNotReturningCollection() ->getMock(); $service->expects($this->once()) ->method('loadRoutes') - ->will($this->returnValue('NOT_A_COLLECTION')); + ->willReturn('NOT_A_COLLECTION'); $loader = new ObjectRouteLoaderForTest(); $loader->loaderMap = ['my_service' => $service]; diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php index e4336cdcac6c..b14fe98d4d4d 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -23,7 +23,7 @@ public function testMissingTrailingSlash() $coll->add('foo', new Route('/foo/')); $matcher = $this->getUrlMatcher($coll); - $matcher->expects($this->once())->method('redirect')->will($this->returnValue([])); + $matcher->expects($this->once())->method('redirect')->willReturn([]); $matcher->match('/foo'); } @@ -51,7 +51,7 @@ public function testSchemeRedirectRedirectsToFirstScheme() ->expects($this->once()) ->method('redirect') ->with('/foo', 'foo', 'ftp') - ->will($this->returnValue(['_route' => 'foo'])) + ->willReturn(['_route' => 'foo']) ; $matcher->match('/foo'); } @@ -78,7 +78,7 @@ public function testSchemeRedirectWithParams() ->expects($this->once()) ->method('redirect') ->with('/foo/baz', 'foo', 'https') - ->will($this->returnValue(['redirect' => 'value'])) + ->willReturn(['redirect' => 'value']) ; $this->assertEquals(['_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'], $matcher->match('/foo/baz')); } @@ -93,7 +93,7 @@ public function testSlashRedirectWithParams() ->expects($this->once()) ->method('redirect') ->with('/foo/baz/', 'foo', null) - ->will($this->returnValue(['redirect' => 'value'])) + ->willReturn(['redirect' => 'value']) ; $this->assertEquals(['_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'], $matcher->match('/foo/baz')); } @@ -124,7 +124,7 @@ public function testFallbackPage() $coll->add('bar', new Route('/{name}')); $matcher = $this->getUrlMatcher($coll); - $matcher->expects($this->once())->method('redirect')->with('/foo/')->will($this->returnValue(['_route' => 'foo'])); + $matcher->expects($this->once())->method('redirect')->with('/foo/')->willReturn(['_route' => 'foo']); $this->assertSame(['_route' => 'foo'], $matcher->match('/foo')); } diff --git a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php index 20afdff484f8..11d9453e0909 100644 --- a/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php @@ -28,7 +28,7 @@ public function testImport() $resolver->expects($this->once()) ->method('resolve') ->with('admin_routing.yml', 'yaml') - ->will($this->returnValue($resolvedLoader)); + ->willReturn($resolvedLoader); $originalRoute = new Route('/foo/path'); $expectedCollection = new RouteCollection(); @@ -39,12 +39,12 @@ public function testImport() ->expects($this->once()) ->method('load') ->with('admin_routing.yml', 'yaml') - ->will($this->returnValue($expectedCollection)); + ->willReturn($expectedCollection); $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); $loader->expects($this->any()) ->method('getResolver') - ->will($this->returnValue($resolver)); + ->willReturn($resolver); // import the file! $routes = new RouteCollectionBuilder($loader); @@ -107,11 +107,11 @@ public function testFlushOrdering() // make this loader able to do the import - keeps mocking simple $loader->expects($this->any()) ->method('supports') - ->will($this->returnValue(true)); + ->willReturn(true); $loader ->expects($this->once()) ->method('load') - ->will($this->returnValue($importedCollection)); + ->willReturn($importedCollection); $routes = new RouteCollectionBuilder($loader); @@ -296,11 +296,11 @@ public function testFlushSetsPrefixedWithMultipleLevels() // make this loader able to do the import - keeps mocking simple $loader->expects($this->any()) ->method('supports') - ->will($this->returnValue(true)); + ->willReturn(true); $loader ->expects($this->any()) ->method('load') - ->will($this->returnValue($importedCollection)); + ->willReturn($importedCollection); // import this from the /admin route builder $adminRoutes->import('admin.yml', '/imported'); @@ -347,11 +347,11 @@ public function testAddsThePrefixOnlyOnceWhenLoadingMultipleCollections() $loader = $this->getMockBuilder('Symfony\Component\Config\Loader\LoaderInterface')->getMock(); $loader->expects($this->any()) ->method('supports') - ->will($this->returnValue(true)); + ->willReturn(true); $loader ->expects($this->any()) ->method('load') - ->will($this->returnValue([$firstCollection, $secondCollection])); + ->willReturn([$firstCollection, $secondCollection]); $routeCollectionBuilder = new RouteCollectionBuilder($loader); $routeCollectionBuilder->import('/directory/recurse/*', '/other/', 'glob'); diff --git a/src/Symfony/Component/Routing/Tests/RouterTest.php b/src/Symfony/Component/Routing/Tests/RouterTest.php index 589ce5403ac2..0f46e5317b68 100644 --- a/src/Symfony/Component/Routing/Tests/RouterTest.php +++ b/src/Symfony/Component/Routing/Tests/RouterTest.php @@ -88,7 +88,7 @@ public function testThatRouteCollectionIsLoaded() $this->loader->expects($this->once()) ->method('load')->with('routing.yml', 'ResourceType') - ->will($this->returnValue($routeCollection)); + ->willReturn($routeCollection); $this->assertSame($routeCollection, $this->router->getRouteCollection()); } @@ -102,7 +102,7 @@ public function testMatcherIsCreatedIfCacheIsNotConfigured($option) $this->loader->expects($this->once()) ->method('load')->with('routing.yml', null) - ->will($this->returnValue(new RouteCollection())); + ->willReturn(new RouteCollection()); $this->assertInstanceOf('Symfony\\Component\\Routing\\Matcher\\UrlMatcher', $this->router->getMatcher()); } @@ -124,7 +124,7 @@ public function testGeneratorIsCreatedIfCacheIsNotConfigured($option) $this->loader->expects($this->once()) ->method('load')->with('routing.yml', null) - ->will($this->returnValue(new RouteCollection())); + ->willReturn(new RouteCollection()); $this->assertInstanceOf('Symfony\\Component\\Routing\\Generator\\UrlGenerator', $this->router->getGenerator()); } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php index fd2de0ca25d4..379da4bb6132 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php @@ -177,13 +177,13 @@ protected function getAuthenticationProvider($supports, $token = null, $exceptio $provider = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface')->getMock(); $provider->expects($this->once()) ->method('supports') - ->will($this->returnValue($supports)) + ->willReturn($supports) ; if (null !== $token) { $provider->expects($this->once()) ->method('authenticate') - ->will($this->returnValue($token)) + ->willReturn($token) ; } elseif (null !== $exception) { $provider->expects($this->once()) diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php index 92441ba5fc61..a888d2bf81b9 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php @@ -58,7 +58,7 @@ protected function getSupportedToken($secret) $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken')->setMethods(['getSecret'])->disableOriginalConstructor()->getMock(); $token->expects($this->any()) ->method('getSecret') - ->will($this->returnValue($secret)) + ->willReturn($secret) ; return $token; diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php index 55814a994c57..53ff17055422 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php @@ -77,7 +77,7 @@ public function testRetrieveUserReturnsUserFromTokenOnReauthentication() $token = $this->getSupportedToken(); $token->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)) + ->willReturn($user) ; $provider = new DaoAuthenticationProvider($userProvider, $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface')->getMock(), 'key', $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface')->getMock()); @@ -95,7 +95,7 @@ public function testRetrieveUser() $userProvider = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface')->getMock(); $userProvider->expects($this->once()) ->method('loadUserByUsername') - ->will($this->returnValue($user)) + ->willReturn($user) ; $provider = new DaoAuthenticationProvider($userProvider, $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface')->getMock(), 'key', $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface')->getMock()); @@ -124,7 +124,7 @@ public function testCheckAuthenticationWhenCredentialsAreEmpty() $token ->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue('')) + ->willReturn('') ; $method->invoke( @@ -140,7 +140,7 @@ public function testCheckAuthenticationWhenCredentialsAre0() $encoder ->expects($this->once()) ->method('isPasswordValid') - ->will($this->returnValue(true)) + ->willReturn(true) ; $provider = $this->getProvider(null, null, $encoder); @@ -151,7 +151,7 @@ public function testCheckAuthenticationWhenCredentialsAre0() $token ->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue('0')) + ->willReturn('0') ; $method->invoke( @@ -169,7 +169,7 @@ public function testCheckAuthenticationWhenCredentialsAreNotValid() $encoder = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface')->getMock(); $encoder->expects($this->once()) ->method('isPasswordValid') - ->will($this->returnValue(false)) + ->willReturn(false) ; $provider = $this->getProvider(null, null, $encoder); @@ -179,7 +179,7 @@ public function testCheckAuthenticationWhenCredentialsAreNotValid() $token = $this->getSupportedToken(); $token->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $method->invoke($provider, $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserInterface')->getMock(), $token); @@ -193,18 +193,18 @@ public function testCheckAuthenticationDoesNotReauthenticateWhenPasswordHasChang $user = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserInterface')->getMock(); $user->expects($this->once()) ->method('getPassword') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $token = $this->getSupportedToken(); $token->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $dbUser = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserInterface')->getMock(); $dbUser->expects($this->once()) ->method('getPassword') - ->will($this->returnValue('newFoo')) + ->willReturn('newFoo') ; $provider = $this->getProvider(); @@ -218,18 +218,18 @@ public function testCheckAuthenticationWhenTokenNeedsReauthenticationWorksWithou $user = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserInterface')->getMock(); $user->expects($this->once()) ->method('getPassword') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $token = $this->getSupportedToken(); $token->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $dbUser = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserInterface')->getMock(); $dbUser->expects($this->once()) ->method('getPassword') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $provider = $this->getProvider(); @@ -243,7 +243,7 @@ public function testCheckAuthentication() $encoder = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface')->getMock(); $encoder->expects($this->once()) ->method('isPasswordValid') - ->will($this->returnValue(true)) + ->willReturn(true) ; $provider = $this->getProvider(null, null, $encoder); @@ -253,7 +253,7 @@ public function testCheckAuthentication() $token = $this->getSupportedToken(); $token->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $method->invoke($provider, $this->getMockBuilder('Symfony\\Component\\Security\\Core\\User\\UserInterface')->getMock(), $token); @@ -265,7 +265,7 @@ protected function getSupportedToken() $mock ->expects($this->any()) ->method('getProviderKey') - ->will($this->returnValue('key')) + ->willReturn('key') ; return $mock; @@ -277,7 +277,7 @@ protected function getProvider($user = null, $userChecker = null, $passwordEncod if (null !== $user) { $userProvider->expects($this->once()) ->method('loadUserByUsername') - ->will($this->returnValue($user)) + ->willReturn($user) ; } @@ -293,7 +293,7 @@ protected function getProvider($user = null, $userChecker = null, $passwordEncod $encoderFactory ->expects($this->any()) ->method('getEncoder') - ->will($this->returnValue($passwordEncoder)) + ->willReturn($passwordEncoder) ; return new DaoAuthenticationProvider($userProvider, $userChecker, 'key', $encoderFactory); diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php index ef19bc2c3273..bad3072f4a9a 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php @@ -113,7 +113,7 @@ public function testQueryForDn() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($collection)) + ->willReturn($collection) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); @@ -121,13 +121,13 @@ public function testQueryForDn() ->expects($this->once()) ->method('escape') ->with('foo', '') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $ldap ->expects($this->once()) ->method('query') ->with('{username}', 'foobar') - ->will($this->returnValue($query)) + ->willReturn($query) ; $userChecker = $this->getMockBuilder(UserCheckerInterface::class)->getMock(); @@ -153,14 +153,14 @@ public function testEmptyQueryResultShouldThrowAnException() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($collection)) + ->willReturn($collection) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $userChecker = $this->getMockBuilder(UserCheckerInterface::class)->getMock(); diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php index a101208d681c..57bce20f5b20 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php @@ -31,7 +31,7 @@ public function testSupports() $token ->expects($this->once()) ->method('getProviderKey') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $this->assertFalse($provider->supports($token)); } @@ -62,7 +62,7 @@ public function testAuthenticate() $user ->expects($this->once()) ->method('getRoles') - ->will($this->returnValue([])) + ->willReturn([]) ; $provider = $this->getProvider($user); @@ -99,20 +99,20 @@ protected function getSupportedToken($user = false, $credentials = false) if (false !== $user) { $token->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)) + ->willReturn($user) ; } if (false !== $credentials) { $token->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue($credentials)) + ->willReturn($credentials) ; } $token ->expects($this->any()) ->method('getProviderKey') - ->will($this->returnValue('key')) + ->willReturn('key') ; $token->setAttributes(['foo' => 'bar']); @@ -126,7 +126,7 @@ protected function getProvider($user = null, $userChecker = null) if (null !== $user) { $userProvider->expects($this->once()) ->method('loadUserByUsername') - ->will($this->returnValue($user)) + ->willReturn($user) ; } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php index 26287693d6b0..6ac7438a064a 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php @@ -69,7 +69,7 @@ public function testAuthenticate() $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $user->expects($this->exactly(2)) ->method('getRoles') - ->will($this->returnValue(['ROLE_FOO'])); + ->willReturn(['ROLE_FOO']); $provider = $this->getProvider(); @@ -89,14 +89,14 @@ protected function getSupportedToken($user = null, $secret = 'test') $user ->expects($this->any()) ->method('getRoles') - ->will($this->returnValue([])); + ->willReturn([]); } $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken')->setMethods(['getProviderKey'])->setConstructorArgs([$user, 'foo', $secret])->getMock(); $token ->expects($this->once()) ->method('getProviderKey') - ->will($this->returnValue('foo')); + ->willReturn('foo'); return $token; } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php index 661d23a4e7e2..07c1618f214d 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php @@ -29,7 +29,7 @@ public function testAuthenticateWhenPreChecksFails() $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token->expects($this->any()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock(); $userChecker->expects($this->once()) @@ -39,7 +39,7 @@ public function testAuthenticateWhenPreChecksFails() $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); $authenticator->expects($this->once()) ->method('authenticateToken') - ->will($this->returnValue($token)); + ->willReturn($token); $provider = $this->getProvider($authenticator, null, $userChecker); @@ -56,7 +56,7 @@ public function testAuthenticateWhenPostChecksFails() $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token->expects($this->any()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $userChecker = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserCheckerInterface')->getMock(); $userChecker->expects($this->once()) @@ -66,7 +66,7 @@ public function testAuthenticateWhenPostChecksFails() $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); $authenticator->expects($this->once()) ->method('authenticateToken') - ->will($this->returnValue($token)); + ->willReturn($token); $provider = $this->getProvider($authenticator, null, $userChecker); @@ -78,11 +78,11 @@ public function testAuthenticateSkipsUserChecksForNonUserInterfaceObjects() $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token->expects($this->any()) ->method('getUser') - ->will($this->returnValue('string-user')); + ->willReturn('string-user'); $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); $authenticator->expects($this->once()) ->method('authenticateToken') - ->will($this->returnValue($token)); + ->willReturn($token); $this->assertSame($token, $this->getProvider($authenticator, null, new UserChecker())->authenticate($token)); } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php index 7c306d2f1f0f..e959d18c5340 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php @@ -76,7 +76,7 @@ public function testAuthenticateWhenProviderDoesNotReturnAnUserInterface() $provider = $this->getProvider(false, true); $provider->expects($this->once()) ->method('retrieveUser') - ->will($this->returnValue(null)) + ->willReturn(null) ; $provider->authenticate($this->getSupportedToken()); @@ -96,7 +96,7 @@ public function testAuthenticateWhenPreChecksFails() $provider = $this->getProvider($userChecker); $provider->expects($this->once()) ->method('retrieveUser') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()) ; $provider->authenticate($this->getSupportedToken()); @@ -116,7 +116,7 @@ public function testAuthenticateWhenPostChecksFails() $provider = $this->getProvider($userChecker); $provider->expects($this->once()) ->method('retrieveUser') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()) ; $provider->authenticate($this->getSupportedToken()); @@ -131,7 +131,7 @@ public function testAuthenticateWhenPostCheckAuthenticationFails() $provider = $this->getProvider(); $provider->expects($this->once()) ->method('retrieveUser') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()) ; $provider->expects($this->once()) ->method('checkAuthentication') @@ -150,7 +150,7 @@ public function testAuthenticateWhenPostCheckAuthenticationFailsWithHideFalse() $provider = $this->getProvider(false, false); $provider->expects($this->once()) ->method('retrieveUser') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()) ; $provider->expects($this->once()) ->method('checkAuthentication') @@ -165,24 +165,24 @@ public function testAuthenticate() $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $user->expects($this->once()) ->method('getRoles') - ->will($this->returnValue(['ROLE_FOO'])) + ->willReturn(['ROLE_FOO']) ; $provider = $this->getProvider(); $provider->expects($this->once()) ->method('retrieveUser') - ->will($this->returnValue($user)) + ->willReturn($user) ; $token = $this->getSupportedToken(); $token->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $token->expects($this->once()) ->method('getRoles') - ->will($this->returnValue([])) + ->willReturn([]) ; $authToken = $provider->authenticate($token); @@ -199,25 +199,25 @@ public function testAuthenticateWithPreservingRoleSwitchUserRole() $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $user->expects($this->once()) ->method('getRoles') - ->will($this->returnValue(['ROLE_FOO'])) + ->willReturn(['ROLE_FOO']) ; $provider = $this->getProvider(); $provider->expects($this->once()) ->method('retrieveUser') - ->will($this->returnValue($user)) + ->willReturn($user) ; $token = $this->getSupportedToken(); $token->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $switchUserRole = new SwitchUserRole('foo', $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $token->expects($this->once()) ->method('getRoles') - ->will($this->returnValue([$switchUserRole])) + ->willReturn([$switchUserRole]) ; $authToken = $provider->authenticate($token); @@ -236,7 +236,7 @@ protected function getSupportedToken() $mock ->expects($this->any()) ->method('getProviderKey') - ->will($this->returnValue('key')) + ->willReturn('key') ; $mock->setAttributes(['foo' => 'bar']); diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php index 8280366d4af6..7516759c0aa8 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php @@ -77,7 +77,7 @@ public function testGetUsername() $this->assertEquals('fabien', $token->getUsername()); $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); - $user->expects($this->once())->method('getUsername')->will($this->returnValue('fabien')); + $user->expects($this->once())->method('getUsername')->willReturn('fabien'); $token->setUser($user); $this->assertEquals('fabien', $token->getUsername()); } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php index 0bdd54dc308b..e1329e37430b 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php @@ -59,7 +59,7 @@ protected function getUser($roles = ['ROLE_FOO']) $user ->expects($this->once()) ->method('getRoles') - ->will($this->returnValue($roles)) + ->willReturn($roles) ; return $user; diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php index 9ee86a079bc9..c60a59b375d3 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php @@ -72,10 +72,10 @@ protected function getVoterFor2Roles($token, $vote1, $vote2) $voter = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface')->getMock(); $voter->expects($this->any()) ->method('vote') - ->will($this->returnValueMap([ + ->willReturnMap([ [$token, null, ['ROLE_FOO'], $vote1], [$token, null, ['ROLE_BAR'], $vote2], - ])) + ]) ; return $voter; @@ -137,7 +137,7 @@ protected function getVoter($vote) $voter = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface')->getMock(); $voter->expects($this->any()) ->method('vote') - ->will($this->returnValue($vote)); + ->willReturn($vote); return $voter; } diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php index 6a07c94f2039..b4986b017786 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php @@ -46,7 +46,7 @@ public function testVoteAuthenticatesTokenIfNecessary() ->expects($this->once()) ->method('authenticate') ->with($this->equalTo($token)) - ->will($this->returnValue($newToken)); + ->willReturn($newToken); // default with() isn't a strict check $tokenComparison = function ($value) use ($newToken) { @@ -58,7 +58,7 @@ public function testVoteAuthenticatesTokenIfNecessary() ->expects($this->once()) ->method('decide') ->with($this->callback($tokenComparison)) - ->will($this->returnValue(true)); + ->willReturn(true); // first run the token has not been re-authenticated yet, after isGranted is called, it should be equal $this->assertNotSame($newToken, $this->tokenStorage->getToken()); @@ -83,12 +83,12 @@ public function testIsGranted($decide) $token ->expects($this->once()) ->method('isAuthenticated') - ->will($this->returnValue(true)); + ->willReturn(true); $this->accessDecisionManager ->expects($this->once()) ->method('decide') - ->will($this->returnValue($decide)); + ->willReturn($decide); $this->tokenStorage->setToken($token); $this->assertSame($decide, $this->authorizationChecker->isGranted('ROLE_FOO')); } diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php index 7e435687c8c3..ce368aa374f7 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php @@ -51,7 +51,7 @@ protected function getToken(array $roles, $tokenExpectsGetRoles = true) if ($tokenExpectsGetRoles) { $token->expects($this->once()) ->method('getRoles') - ->will($this->returnValue($roles)); + ->willReturn($roles); } return $token; @@ -64,7 +64,7 @@ protected function createExpressionLanguage($expressionLanguageExpectsEvaluate = if ($expressionLanguageExpectsEvaluate) { $mock->expects($this->once()) ->method('evaluate') - ->will($this->returnValue(true)); + ->willReturn(true); } return $mock; diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleVoterTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleVoterTest.php index 5fb45e08b392..955ab842e139 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleVoterTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleVoterTest.php @@ -54,7 +54,7 @@ protected function getToken(array $roles) $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token->expects($this->once()) ->method('getRoles') - ->will($this->returnValue($roles)); + ->willReturn($roles); return $token; } diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php index 3328837ef1f7..41a602f97604 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php @@ -21,19 +21,19 @@ public function testEncodePassword() $userMock = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $userMock->expects($this->any()) ->method('getSalt') - ->will($this->returnValue('userSalt')); + ->willReturn('userSalt'); $mockEncoder = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface')->getMock(); $mockEncoder->expects($this->any()) ->method('encodePassword') ->with($this->equalTo('plainPassword'), $this->equalTo('userSalt')) - ->will($this->returnValue('encodedPassword')); + ->willReturn('encodedPassword'); $mockEncoderFactory = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface')->getMock(); $mockEncoderFactory->expects($this->any()) ->method('getEncoder') ->with($this->equalTo($userMock)) - ->will($this->returnValue($mockEncoder)); + ->willReturn($mockEncoder); $passwordEncoder = new UserPasswordEncoder($mockEncoderFactory); @@ -46,22 +46,22 @@ public function testIsPasswordValid() $userMock = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $userMock->expects($this->any()) ->method('getSalt') - ->will($this->returnValue('userSalt')); + ->willReturn('userSalt'); $userMock->expects($this->any()) ->method('getPassword') - ->will($this->returnValue('encodedPassword')); + ->willReturn('encodedPassword'); $mockEncoder = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface')->getMock(); $mockEncoder->expects($this->any()) ->method('isPasswordValid') ->with($this->equalTo('encodedPassword'), $this->equalTo('plainPassword'), $this->equalTo('userSalt')) - ->will($this->returnValue(true)); + ->willReturn(true); $mockEncoderFactory = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface')->getMock(); $mockEncoderFactory->expects($this->any()) ->method('getEncoder') ->with($this->equalTo($userMock)) - ->will($this->returnValue($mockEncoder)); + ->willReturn($mockEncoder); $passwordEncoder = new UserPasswordEncoder($mockEncoderFactory); diff --git a/src/Symfony/Component/Security/Core/Tests/SecurityTest.php b/src/Symfony/Component/Security/Core/Tests/SecurityTest.php index 7a1b572fc7d0..fa3e416e55c1 100644 --- a/src/Symfony/Component/Security/Core/Tests/SecurityTest.php +++ b/src/Symfony/Component/Security/Core/Tests/SecurityTest.php @@ -29,7 +29,7 @@ public function testGetToken() $tokenStorage->expects($this->once()) ->method('getToken') - ->will($this->returnValue($token)); + ->willReturn($token); $container = $this->createContainer('security.token_storage', $tokenStorage); @@ -45,12 +45,12 @@ public function testGetUser($userInToken, $expectedUser) $token = $this->getMockBuilder(TokenInterface::class)->getMock(); $token->expects($this->any()) ->method('getUser') - ->will($this->returnValue($userInToken)); + ->willReturn($userInToken); $tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock(); $tokenStorage->expects($this->once()) ->method('getToken') - ->will($this->returnValue($token)); + ->willReturn($token); $container = $this->createContainer('security.token_storage', $tokenStorage); @@ -75,7 +75,7 @@ public function testIsGranted() $authorizationChecker->expects($this->once()) ->method('isGranted') ->with('SOME_ATTRIBUTE', 'SOME_SUBJECT') - ->will($this->returnValue(true)); + ->willReturn(true); $container = $this->createContainer('security.authorization_checker', $authorizationChecker); @@ -90,7 +90,7 @@ private function createContainer($serviceId, $serviceObject) $container->expects($this->atLeastOnce()) ->method('get') ->with($serviceId) - ->will($this->returnValue($serviceObject)); + ->willReturn($serviceObject); return $container; } diff --git a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php index 067eef2497b8..05a7fbba19d8 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php @@ -33,7 +33,7 @@ public function testLoadUserByUsername() ->expects($this->once()) ->method('loadUserByUsername') ->with($this->equalTo('foo')) - ->will($this->returnValue($account = $this->getAccount())) + ->willReturn($account = $this->getAccount()) ; $provider = new ChainUserProvider([$provider1, $provider2]); @@ -78,7 +78,7 @@ public function testRefreshUser() $provider2 ->expects($this->once()) ->method('refreshUser') - ->will($this->returnValue($account = $this->getAccount())) + ->willReturn($account = $this->getAccount()) ; $provider = new ChainUserProvider([$provider1, $provider2]); @@ -98,7 +98,7 @@ public function testRefreshUserAgain() $provider2 ->expects($this->once()) ->method('refreshUser') - ->will($this->returnValue($account = $this->getAccount())) + ->willReturn($account = $this->getAccount()) ; $provider = new ChainUserProvider([$provider1, $provider2]); @@ -135,7 +135,7 @@ public function testSupportsClass() ->expects($this->once()) ->method('supportsClass') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)) + ->willReturn(false) ; $provider2 = $this->getProvider(); @@ -143,7 +143,7 @@ public function testSupportsClass() ->expects($this->once()) ->method('supportsClass') ->with($this->equalTo('foo')) - ->will($this->returnValue(true)) + ->willReturn(true) ; $provider = new ChainUserProvider([$provider1, $provider2]); @@ -157,7 +157,7 @@ public function testSupportsClassWhenNotSupported() ->expects($this->once()) ->method('supportsClass') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)) + ->willReturn(false) ; $provider2 = $this->getProvider(); @@ -165,7 +165,7 @@ public function testSupportsClassWhenNotSupported() ->expects($this->once()) ->method('supportsClass') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)) + ->willReturn(false) ; $provider = new ChainUserProvider([$provider1, $provider2]); @@ -185,7 +185,7 @@ public function testAcceptsTraversable() $provider2 ->expects($this->once()) ->method('refreshUser') - ->will($this->returnValue($account = $this->getAccount())) + ->willReturn($account = $this->getAccount()) ; $provider = new ChainUserProvider(new \ArrayObject([$provider1, $provider2])); diff --git a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php index 418475ac9381..39a346433e46 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php @@ -50,23 +50,23 @@ public function testLoadUserByUsernameFailsIfNoLdapEntries() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($result)) + ->willReturn($result) ; $result ->expects($this->once()) ->method('count') - ->will($this->returnValue(0)) + ->willReturn(0) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $ldap ->expects($this->once()) ->method('escape') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com'); @@ -83,23 +83,23 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapEntry() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($result)) + ->willReturn($result) ; $result ->expects($this->once()) ->method('count') - ->will($this->returnValue(2)) + ->willReturn(2) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $ldap ->expects($this->once()) ->method('escape') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com'); @@ -116,33 +116,33 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($result)) + ->willReturn($result) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result ->expects($this->once()) ->method('offsetGet') ->with(0) - ->will($this->returnValue(new Entry('foo', [ + ->willReturn(new Entry('foo', [ 'sAMAccountName' => ['foo'], 'userpassword' => ['bar', 'baz'], ] - ))) + )) ; $result ->expects($this->once()) ->method('count') - ->will($this->returnValue(1)) + ->willReturn(1) ; $ldap ->expects($this->once()) ->method('escape') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null, [], 'sAMAccountName', '({uid_key}={username})', 'userpassword'); @@ -159,29 +159,29 @@ public function testLoadUserByUsernameShouldNotFailIfEntryHasNoUidKeyAttribute() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($result)) + ->willReturn($result) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result ->expects($this->once()) ->method('offsetGet') ->with(0) - ->will($this->returnValue(new Entry('foo', []))) + ->willReturn(new Entry('foo', [])) ; $result ->expects($this->once()) ->method('count') - ->will($this->returnValue(1)) + ->willReturn(1) ; $ldap ->expects($this->once()) ->method('escape') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null, [], 'sAMAccountName', '({uid_key}={username})'); @@ -201,32 +201,32 @@ public function testLoadUserByUsernameFailsIfEntryHasNoPasswordAttribute() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($result)) + ->willReturn($result) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result ->expects($this->once()) ->method('offsetGet') ->with(0) - ->will($this->returnValue(new Entry('foo', [ + ->willReturn(new Entry('foo', [ 'sAMAccountName' => ['foo'], ] - ))) + )) ; $result ->expects($this->once()) ->method('count') - ->will($this->returnValue(1)) + ->willReturn(1) ; $ldap ->expects($this->once()) ->method('escape') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null, [], 'sAMAccountName', '({uid_key}={username})', 'userpassword'); @@ -243,32 +243,32 @@ public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttribute() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($result)) + ->willReturn($result) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result ->expects($this->once()) ->method('offsetGet') ->with(0) - ->will($this->returnValue(new Entry('foo', [ + ->willReturn(new Entry('foo', [ 'sAMAccountName' => ['foo'], ] - ))) + )) ; $result ->expects($this->once()) ->method('count') - ->will($this->returnValue(1)) + ->willReturn(1) ; $ldap ->expects($this->once()) ->method('escape') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com'); @@ -285,32 +285,32 @@ public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttributeAndWro $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($result)) + ->willReturn($result) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result ->expects($this->once()) ->method('offsetGet') ->with(0) - ->will($this->returnValue(new Entry('foo', [ + ->willReturn(new Entry('foo', [ 'sAMAccountName' => ['foo'], ] - ))) + )) ; $result ->expects($this->once()) ->method('count') - ->will($this->returnValue(1)) + ->willReturn(1) ; $ldap ->expects($this->once()) ->method('escape') - ->will($this->returnValue('Foo')) + ->willReturn('Foo') ; $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com'); @@ -324,33 +324,33 @@ public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute() $query ->expects($this->once()) ->method('execute') - ->will($this->returnValue($result)) + ->willReturn($result) ; $ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $result ->expects($this->once()) ->method('offsetGet') ->with(0) - ->will($this->returnValue(new Entry('foo', [ + ->willReturn(new Entry('foo', [ 'sAMAccountName' => ['foo'], 'userpassword' => ['bar'], ] - ))) + )) ; $result ->expects($this->once()) ->method('count') - ->will($this->returnValue(1)) + ->willReturn(1) ; $ldap ->expects($this->once()) ->method('escape') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $ldap ->expects($this->once()) ->method('query') - ->will($this->returnValue($query)) + ->willReturn($query) ; $provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null, [], 'sAMAccountName', '({uid_key}={username})', 'userpassword'); diff --git a/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php index 8ec34843eaae..16eea31c4f0e 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php +++ b/src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php @@ -28,7 +28,7 @@ public function testCheckPostAuthPass() $checker = new UserChecker(); $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock(); - $account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(true)); + $account->expects($this->once())->method('isCredentialsNonExpired')->willReturn(true); $this->assertNull($checker->checkPostAuth($account)); } @@ -41,7 +41,7 @@ public function testCheckPostAuthCredentialsExpired() $checker = new UserChecker(); $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock(); - $account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(false)); + $account->expects($this->once())->method('isCredentialsNonExpired')->willReturn(false); $checker->checkPostAuth($account); } @@ -58,9 +58,9 @@ public function testCheckPreAuthPass() $checker = new UserChecker(); $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock(); - $account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true)); - $account->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); - $account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(true)); + $account->expects($this->once())->method('isAccountNonLocked')->willReturn(true); + $account->expects($this->once())->method('isEnabled')->willReturn(true); + $account->expects($this->once())->method('isAccountNonExpired')->willReturn(true); $this->assertNull($checker->checkPreAuth($account)); } @@ -73,7 +73,7 @@ public function testCheckPreAuthAccountLocked() $checker = new UserChecker(); $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock(); - $account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(false)); + $account->expects($this->once())->method('isAccountNonLocked')->willReturn(false); $checker->checkPreAuth($account); } @@ -86,8 +86,8 @@ public function testCheckPreAuthDisabled() $checker = new UserChecker(); $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock(); - $account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true)); - $account->expects($this->once())->method('isEnabled')->will($this->returnValue(false)); + $account->expects($this->once())->method('isAccountNonLocked')->willReturn(true); + $account->expects($this->once())->method('isEnabled')->willReturn(false); $checker->checkPreAuth($account); } @@ -100,9 +100,9 @@ public function testCheckPreAuthAccountExpired() $checker = new UserChecker(); $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\AdvancedUserInterface')->getMock(); - $account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true)); - $account->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); - $account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(false)); + $account->expects($this->once())->method('isAccountNonLocked')->willReturn(true); + $account->expects($this->once())->method('isEnabled')->willReturn(true); + $account->expects($this->once())->method('isAccountNonExpired')->willReturn(false); $checker->checkPreAuth($account); } diff --git a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php index 24c2c7adda18..305b665ea32c 100644 --- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php @@ -65,7 +65,7 @@ public function testPasswordIsValid() $this->encoder->expects($this->once()) ->method('isPasswordValid') ->with(static::PASSWORD, 'secret', static::SALT) - ->will($this->returnValue(true)); + ->willReturn(true); $this->validator->validate('secret', $constraint); @@ -81,7 +81,7 @@ public function testPasswordIsNotValid() $this->encoder->expects($this->once()) ->method('isPasswordValid') ->with(static::PASSWORD, 'secret', static::SALT) - ->will($this->returnValue(false)); + ->willReturn(false); $this->validator->validate('secret', $constraint); @@ -133,13 +133,13 @@ protected function createUser() $mock ->expects($this->any()) ->method('getPassword') - ->will($this->returnValue(static::PASSWORD)) + ->willReturn(static::PASSWORD) ; $mock ->expects($this->any()) ->method('getSalt') - ->will($this->returnValue(static::SALT)) + ->willReturn(static::SALT) ; return $mock; @@ -157,7 +157,7 @@ protected function createEncoderFactory($encoder = null) $mock ->expects($this->any()) ->method('getEncoder') - ->will($this->returnValue($encoder)) + ->willReturn($encoder) ; return $mock; @@ -171,7 +171,7 @@ protected function createTokenStorage($user = null) $mock ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)) + ->willReturn($token) ; return $mock; @@ -183,7 +183,7 @@ protected function createAuthenticationToken($user = null) $mock ->expects($this->any()) ->method('getUser') - ->will($this->returnValue($user)) + ->willReturn($user) ; return $mock; diff --git a/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php b/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php index b954fc037b90..631c36a0db0a 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php @@ -30,11 +30,11 @@ public function testGetNonExistingToken($namespace, $manager, $storage, $generat $storage->expects($this->once()) ->method('hasToken') ->with($namespace.'token_id') - ->will($this->returnValue(false)); + ->willReturn(false); $generator->expects($this->once()) ->method('generateToken') - ->will($this->returnValue('TOKEN')); + ->willReturn('TOKEN'); $storage->expects($this->once()) ->method('setToken') @@ -55,12 +55,12 @@ public function testUseExistingTokenIfAvailable($namespace, $manager, $storage) $storage->expects($this->once()) ->method('hasToken') ->with($namespace.'token_id') - ->will($this->returnValue(true)); + ->willReturn(true); $storage->expects($this->once()) ->method('getToken') ->with($namespace.'token_id') - ->will($this->returnValue('TOKEN')); + ->willReturn('TOKEN'); $token = $manager->getToken('token_id'); @@ -79,7 +79,7 @@ public function testRefreshTokenAlwaysReturnsNewToken($namespace, $manager, $sto $generator->expects($this->once()) ->method('generateToken') - ->will($this->returnValue('TOKEN')); + ->willReturn('TOKEN'); $storage->expects($this->once()) ->method('setToken') @@ -100,12 +100,12 @@ public function testMatchingTokenIsValid($namespace, $manager, $storage) $storage->expects($this->once()) ->method('hasToken') ->with($namespace.'token_id') - ->will($this->returnValue(true)); + ->willReturn(true); $storage->expects($this->once()) ->method('getToken') ->with($namespace.'token_id') - ->will($this->returnValue('TOKEN')); + ->willReturn('TOKEN'); $this->assertTrue($manager->isTokenValid(new CsrfToken('token_id', 'TOKEN'))); } @@ -118,12 +118,12 @@ public function testNonMatchingTokenIsNotValid($namespace, $manager, $storage) $storage->expects($this->once()) ->method('hasToken') ->with($namespace.'token_id') - ->will($this->returnValue(true)); + ->willReturn(true); $storage->expects($this->once()) ->method('getToken') ->with($namespace.'token_id') - ->will($this->returnValue('TOKEN')); + ->willReturn('TOKEN'); $this->assertFalse($manager->isTokenValid(new CsrfToken('token_id', 'FOOBAR'))); } @@ -136,7 +136,7 @@ public function testNonExistingTokenIsNotValid($namespace, $manager, $storage) $storage->expects($this->once()) ->method('hasToken') ->with($namespace.'token_id') - ->will($this->returnValue(false)); + ->willReturn(false); $storage->expects($this->never()) ->method('getToken'); @@ -152,7 +152,7 @@ public function testRemoveToken($namespace, $manager, $storage) $storage->expects($this->once()) ->method('removeToken') ->with($namespace.'token_id') - ->will($this->returnValue('REMOVED_TOKEN')); + ->willReturn('REMOVED_TOKEN'); $this->assertSame('REMOVED_TOKEN', $manager->removeToken('token_id')); } diff --git a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php index ca472f87bc5e..c3983287fc42 100644 --- a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php @@ -77,7 +77,7 @@ public function testAuthenticationSuccessWithSessionButEmpty() $this->requestWithSession->getSession() ->expects($this->once()) ->method('get') - ->will($this->returnValue(null)); + ->willReturn(null); $redirectResponse = $this->authenticator->onAuthenticationSuccess($this->requestWithSession, $token, 'providerkey'); @@ -96,7 +96,7 @@ public function testAuthenticationSuccessWithSessionAndTarget() $this->requestWithSession->getSession() ->expects($this->once()) ->method('get') - ->will($this->returnValue(self::CUSTOM_SUCCESS_URL)); + ->willReturn(self::CUSTOM_SUCCESS_URL); $redirectResponse = $this->authenticator->onAuthenticationSuccess($this->requestWithSession, $token, 'providerkey'); diff --git a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php index fa4e9ef62312..7e4d2929b638 100644 --- a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php @@ -51,7 +51,7 @@ public function testHandleSuccess() ->expects($this->once()) ->method('getCredentials') ->with($this->equalTo($this->request)) - ->will($this->returnValue($credentials)); + ->willReturn($credentials); // a clone of the token that should be created internally $uniqueGuardKey = 'my_firewall_0'; @@ -61,7 +61,7 @@ public function testHandleSuccess() ->expects($this->once()) ->method('authenticate') ->with($this->equalTo($nonAuthedToken)) - ->will($this->returnValue($authenticateToken)); + ->willReturn($authenticateToken); $this->guardAuthenticatorHandler ->expects($this->once()) @@ -139,18 +139,18 @@ public function testHandleSuccessWithRememberMe() ->expects($this->once()) ->method('getCredentials') ->with($this->equalTo($this->request)) - ->will($this->returnValue(['username' => 'anything_not_empty'])); + ->willReturn(['username' => 'anything_not_empty']); $this->authenticationManager ->expects($this->once()) ->method('authenticate') - ->will($this->returnValue($authenticateToken)); + ->willReturn($authenticateToken); $successResponse = new Response('Success!'); $this->guardAuthenticatorHandler ->expects($this->once()) ->method('handleAuthenticationSuccess') - ->will($this->returnValue($successResponse)); + ->willReturn($successResponse); $listener = new GuardAuthenticationListener( $this->guardAuthenticatorHandler, @@ -163,7 +163,7 @@ public function testHandleSuccessWithRememberMe() $listener->setRememberMeServices($this->rememberMeServices); $authenticator->expects($this->once()) ->method('supportsRememberMe') - ->will($this->returnValue(true)); + ->willReturn(true); // should be called - we do have a success Response $this->rememberMeServices ->expects($this->once()) @@ -219,7 +219,7 @@ public function testLegacyInterfaceNullCredentials() $authenticatorA ->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue(null)); + ->willReturn(null); // this is not called $this->authenticationManager @@ -256,7 +256,7 @@ public function testLegacyInterfaceKeepsWorking() ->expects($this->once()) ->method('getCredentials') ->with($this->equalTo($this->request)) - ->will($this->returnValue($credentials)); + ->willReturn($credentials); // a clone of the token that should be created internally $uniqueGuardKey = 'my_firewall_0'; @@ -266,7 +266,7 @@ public function testLegacyInterfaceKeepsWorking() ->expects($this->once()) ->method('authenticate') ->with($this->equalTo($nonAuthedToken)) - ->will($this->returnValue($authenticateToken)); + ->willReturn($authenticateToken); $this->guardAuthenticatorHandler ->expects($this->once()) @@ -307,11 +307,11 @@ public function testReturnNullToSkipAuth() $authenticatorA ->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue(null)); + ->willReturn(null); $authenticatorB ->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue(null)); + ->willReturn(null); // this is not called $this->authenticationManager @@ -341,7 +341,7 @@ public function testSupportsReturnFalseSkipAuth() $authenticator ->expects($this->once()) ->method('supports') - ->will($this->returnValue(false)); + ->willReturn(false); // this is not called $authenticator @@ -370,13 +370,13 @@ public function testReturnNullFromGetCredentials() $authenticator ->expects($this->once()) ->method('supports') - ->will($this->returnValue(true)); + ->willReturn(true); // this will raise exception $authenticator ->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue(null)); + ->willReturn(null); $listener = new GuardAuthenticationListener( $this->guardAuthenticatorHandler, @@ -401,13 +401,13 @@ public function testReturnNullFromGetCredentialsTriggersForAbstractGuardAuthenti $authenticator ->expects($this->once()) ->method('supports') - ->will($this->returnValue(true)); + ->willReturn(true); // this will raise exception $authenticator ->expects($this->once()) ->method('getCredentials') - ->will($this->returnValue(null)); + ->willReturn(null); $listener = new GuardAuthenticationListener( $this->guardAuthenticatorHandler, @@ -439,7 +439,7 @@ protected function setUp() $this->event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($this->request)); + ->willReturn($this->request); $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $this->rememberMeServices = $this->getMockBuilder('Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface')->getMock(); diff --git a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php index 9950426de9e2..3bf204ec7f5c 100644 --- a/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php @@ -54,7 +54,7 @@ public function testHandleAuthenticationSuccess() $this->guardAuthenticator->expects($this->once()) ->method('onAuthenticationSuccess') ->with($this->request, $this->token, $providerKey) - ->will($this->returnValue($response)); + ->willReturn($response); $handler = new GuardAuthenticatorHandler($this->tokenStorage, $this->dispatcher); $actualResponse = $handler->handleAuthenticationSuccess($this->token, $this->request, $this->guardAuthenticator, $providerKey); @@ -73,7 +73,7 @@ public function testHandleAuthenticationFailure() $this->guardAuthenticator->expects($this->once()) ->method('onAuthenticationFailure') ->with($this->request, $authException) - ->will($this->returnValue($response)); + ->willReturn($response); $handler = new GuardAuthenticatorHandler($this->tokenStorage, $this->dispatcher); $actualResponse = $handler->handleAuthenticationFailure($authException, $this->request, $this->guardAuthenticator, 'firewall_provider_key'); @@ -90,7 +90,7 @@ public function testHandleAuthenticationClearsToken($tokenClass, $tokenProviderK ->getMock(); $token->expects($this->any()) ->method('getProviderKey') - ->will($this->returnValue($tokenProviderKey)); + ->willReturn($tokenProviderKey); $this->tokenStorage->expects($this->never()) ->method('setToken') @@ -101,7 +101,7 @@ public function testHandleAuthenticationClearsToken($tokenClass, $tokenProviderK $this->guardAuthenticator->expects($this->once()) ->method('onAuthenticationFailure') ->with($this->request, $authException) - ->will($this->returnValue($response)); + ->willReturn($response); $handler = new GuardAuthenticatorHandler($this->tokenStorage, $this->dispatcher); $actualResponse = $handler->handleAuthenticationFailure($authException, $this->request, $this->guardAuthenticator, $actualProviderKey); diff --git a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php index a6636dd2f7f3..26f830e500d4 100644 --- a/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php @@ -41,7 +41,7 @@ public function testAuthenticate() $this->preAuthenticationToken->expects($this->exactly(2)) ->method('getGuardProviderKey') // it will return the "1" index, which will match authenticatorB - ->will($this->returnValue('my_cool_firewall_1')); + ->willReturn('my_cool_firewall_1'); $enteredCredentials = [ 'username' => '_weaverryan_test_user', @@ -49,7 +49,7 @@ public function testAuthenticate() ]; $this->preAuthenticationToken->expects($this->atLeastOnce()) ->method('getCredentials') - ->will($this->returnValue($enteredCredentials)); + ->willReturn($enteredCredentials); // authenticators A and C are never called $authenticatorA->expects($this->never()) @@ -61,18 +61,18 @@ public function testAuthenticate() $authenticatorB->expects($this->once()) ->method('getUser') ->with($enteredCredentials, $this->userProvider) - ->will($this->returnValue($mockedUser)); + ->willReturn($mockedUser); // checkCredentials is called $authenticatorB->expects($this->once()) ->method('checkCredentials') ->with($enteredCredentials, $mockedUser) // authentication works! - ->will($this->returnValue(true)); + ->willReturn(true); $authedToken = $this->getMockBuilder(TokenInterface::class)->getMock(); $authenticatorB->expects($this->once()) ->method('createAuthenticatedToken') ->with($mockedUser, $providerKey) - ->will($this->returnValue($authedToken)); + ->willReturn($authedToken); // user checker should be called $this->userChecker->expects($this->once()) @@ -103,7 +103,7 @@ public function testLegacyAuthenticate() $this->preAuthenticationToken->expects($this->exactly(2)) ->method('getGuardProviderKey') // it will return the "1" index, which will match authenticatorB - ->will($this->returnValue('my_cool_firewall_1')); + ->willReturn('my_cool_firewall_1'); $enteredCredentials = [ 'username' => '_weaverryan_test_user', @@ -111,7 +111,7 @@ public function testLegacyAuthenticate() ]; $this->preAuthenticationToken->expects($this->atLeastOnce()) ->method('getCredentials') - ->will($this->returnValue($enteredCredentials)); + ->willReturn($enteredCredentials); // authenticators A and C are never called $authenticatorA->expects($this->never()) @@ -123,18 +123,18 @@ public function testLegacyAuthenticate() $authenticatorB->expects($this->once()) ->method('getUser') ->with($enteredCredentials, $this->userProvider) - ->will($this->returnValue($mockedUser)); + ->willReturn($mockedUser); // checkCredentials is called $authenticatorB->expects($this->once()) ->method('checkCredentials') ->with($enteredCredentials, $mockedUser) // authentication works! - ->will($this->returnValue(true)); + ->willReturn(true); $authedToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $authenticatorB->expects($this->once()) ->method('createAuthenticatedToken') ->with($mockedUser, $providerKey) - ->will($this->returnValue($authedToken)); + ->willReturn($authedToken); // user checker should be called $this->userChecker->expects($this->once()) @@ -162,21 +162,21 @@ public function testCheckCredentialsReturningNonTrueFailsAuthentication() $this->preAuthenticationToken->expects($this->any()) ->method('getGuardProviderKey') // the 0 index, to match the only authenticator - ->will($this->returnValue('my_uncool_firewall_0')); + ->willReturn('my_uncool_firewall_0'); $this->preAuthenticationToken->expects($this->atLeastOnce()) ->method('getCredentials') - ->will($this->returnValue('non-null-value')); + ->willReturn('non-null-value'); $mockedUser = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); $authenticator->expects($this->once()) ->method('getUser') - ->will($this->returnValue($mockedUser)); + ->willReturn($mockedUser); // checkCredentials is called $authenticator->expects($this->once()) ->method('checkCredentials') // authentication fails :( - ->will($this->returnValue(null)); + ->willReturn(null); $provider = new GuardAuthenticationProvider([$authenticator], $this->userProvider, $providerKey, $this->userChecker); $provider->authenticate($this->preAuthenticationToken); diff --git a/src/Symfony/Component/Security/Http/Tests/AccessMapTest.php b/src/Symfony/Component/Security/Http/Tests/AccessMapTest.php index 8ae9581e2c84..1f5356ba9ee5 100644 --- a/src/Symfony/Component/Security/Http/Tests/AccessMapTest.php +++ b/src/Symfony/Component/Security/Http/Tests/AccessMapTest.php @@ -45,7 +45,7 @@ private function getRequestMatcher($request, $matches) $requestMatcher = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestMatcherInterface')->getMock(); $requestMatcher->expects($this->once()) ->method('matches')->with($request) - ->will($this->returnValue($matches)); + ->willReturn($matches); return $requestMatcher; } diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php index a9c18f3475d5..a71ad179a355 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php @@ -34,7 +34,7 @@ protected function setUp() $this->session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock(); $this->request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $this->request->expects($this->any())->method('getSession')->will($this->returnValue($this->session)); + $this->request->expects($this->any())->method('getSession')->willReturn($this->session); $this->exception = $this->getMockBuilder('Symfony\Component\Security\Core\Exception\AuthenticationException')->setMethods(['getMessage'])->getMock(); } @@ -47,12 +47,12 @@ public function testForward() ->method('set')->with(Security::AUTHENTICATION_ERROR, $this->exception); $this->httpUtils->expects($this->once()) ->method('createRequest')->with($this->request, '/login') - ->will($this->returnValue($subRequest)); + ->willReturn($subRequest); $response = new Response(); $this->httpKernel->expects($this->once()) ->method('handle')->with($subRequest, HttpKernelInterface::SUB_REQUEST) - ->will($this->returnValue($response)); + ->willReturn($response); $handler = new DefaultAuthenticationFailureHandler($this->httpKernel, $this->httpUtils, $options, $this->logger); $result = $handler->onAuthenticationFailure($this->request, $this->exception); @@ -65,7 +65,7 @@ public function testRedirect() $response = new Response(); $this->httpUtils->expects($this->once()) ->method('createRedirectResponse')->with($this->request, '/login') - ->will($this->returnValue($response)); + ->willReturn($response); $handler = new DefaultAuthenticationFailureHandler($this->httpKernel, $this->httpUtils, [], $this->logger); $result = $handler->onAuthenticationFailure($this->request, $this->exception); @@ -92,7 +92,7 @@ public function testExceptionIsPassedInRequestOnForward() $this->httpUtils->expects($this->once()) ->method('createRequest')->with($this->request, '/login') - ->will($this->returnValue($subRequest)); + ->willReturn($subRequest); $this->session->expects($this->never())->method('set'); @@ -117,7 +117,7 @@ public function testForwardIsLogged() $this->httpUtils->expects($this->once()) ->method('createRequest')->with($this->request, '/login') - ->will($this->returnValue($this->getRequest())); + ->willReturn($this->getRequest()); $this->logger ->expects($this->once()) @@ -143,7 +143,7 @@ public function testFailurePathCanBeOverwrittenWithRequest() { $this->request->expects($this->once()) ->method('get')->with('_failure_path') - ->will($this->returnValue('/auth/login')); + ->willReturn('/auth/login'); $this->httpUtils->expects($this->once()) ->method('createRedirectResponse')->with($this->request, '/auth/login'); @@ -156,7 +156,7 @@ public function testFailurePathCanBeOverwrittenWithNestedAttributeInRequest() { $this->request->expects($this->once()) ->method('get')->with('_failure_path') - ->will($this->returnValue(['value' => '/auth/login'])); + ->willReturn(['value' => '/auth/login']); $this->httpUtils->expects($this->once()) ->method('createRedirectResponse')->with($this->request, '/auth/login'); @@ -171,7 +171,7 @@ public function testFailurePathParameterCanBeOverwritten() $this->request->expects($this->once()) ->method('get')->with('_my_failure_path') - ->will($this->returnValue('/auth/login')); + ->willReturn('/auth/login'); $this->httpUtils->expects($this->once()) ->method('createRedirectResponse')->with($this->request, '/auth/login'); diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php index 531d49227f2c..8f0ba0728c87 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php @@ -24,7 +24,7 @@ class DefaultAuthenticationSuccessHandlerTest extends TestCase public function testRequestRedirections(Request $request, $options, $redirectedUrl) { $urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock(); - $urlGenerator->expects($this->any())->method('generate')->will($this->returnValue('http://localhost/login')); + $urlGenerator->expects($this->any())->method('generate')->willReturn('http://localhost/login'); $httpUtils = new HttpUtils($urlGenerator); $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $handler = new DefaultAuthenticationSuccessHandler($httpUtils, $options); @@ -37,7 +37,7 @@ public function testRequestRedirections(Request $request, $options, $redirectedU public function getRequestRedirections() { $session = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock(); - $session->expects($this->once())->method('get')->with('_security.admin.target_path')->will($this->returnValue('/admin/dashboard')); + $session->expects($this->once())->method('get')->with('_security.admin.target_path')->willReturn('/admin/dashboard'); $session->expects($this->once())->method('remove')->with('_security.admin.target_path'); $requestWithSession = Request::create('/'); $requestWithSession->setSession($session); diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php index 4f73e5f44cdf..70923ae31806 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php @@ -53,7 +53,7 @@ public function testOnAuthenticationSuccessFallsBackToDefaultHandlerIfSimpleIsNo $this->successHandler->expects($this->once()) ->method('onAuthenticationSuccess') ->with($this->request, $this->token) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); $handler = new SimpleAuthenticationHandler($authenticator, $this->successHandler, $this->failureHandler); $result = $handler->onAuthenticationSuccess($this->request, $this->token); @@ -70,7 +70,7 @@ public function testOnAuthenticationSuccessCallsSimpleAuthenticator() $authenticator->expects($this->once()) ->method('onAuthenticationSuccess') ->with($this->request, $this->token) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); $handler = new SimpleAuthenticationHandler($authenticator, $this->successHandler, $this->failureHandler); $result = $handler->onAuthenticationSuccess($this->request, $this->token); @@ -91,7 +91,7 @@ public function testOnAuthenticationSuccessThrowsAnExceptionIfNonResponseIsRetur $authenticator->expects($this->once()) ->method('onAuthenticationSuccess') ->with($this->request, $this->token) - ->will($this->returnValue(new \stdClass())); + ->willReturn(new \stdClass()); $handler = new SimpleAuthenticationHandler($authenticator, $this->successHandler, $this->failureHandler); $handler->onAuthenticationSuccess($this->request, $this->token); @@ -102,13 +102,13 @@ public function testOnAuthenticationSuccessFallsBackToDefaultHandlerIfNullIsRetu $this->successHandler->expects($this->once()) ->method('onAuthenticationSuccess') ->with($this->request, $this->token) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); $authenticator = $this->getMockForAbstractClass('Symfony\Component\Security\Http\Tests\TestSuccessHandlerInterface'); $authenticator->expects($this->once()) ->method('onAuthenticationSuccess') ->with($this->request, $this->token) - ->will($this->returnValue(null)); + ->willReturn(null); $handler = new SimpleAuthenticationHandler($authenticator, $this->successHandler, $this->failureHandler); $result = $handler->onAuthenticationSuccess($this->request, $this->token); @@ -123,7 +123,7 @@ public function testOnAuthenticationFailureFallsBackToDefaultHandlerIfSimpleIsNo $this->failureHandler->expects($this->once()) ->method('onAuthenticationFailure') ->with($this->request, $this->authenticationException) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); $handler = new SimpleAuthenticationHandler($authenticator, $this->successHandler, $this->failureHandler); $result = $handler->onAuthenticationFailure($this->request, $this->authenticationException); @@ -140,7 +140,7 @@ public function testOnAuthenticationFailureCallsSimpleAuthenticator() $authenticator->expects($this->once()) ->method('onAuthenticationFailure') ->with($this->request, $this->authenticationException) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); $handler = new SimpleAuthenticationHandler($authenticator, $this->successHandler, $this->failureHandler); $result = $handler->onAuthenticationFailure($this->request, $this->authenticationException); @@ -161,7 +161,7 @@ public function testOnAuthenticationFailureThrowsAnExceptionIfNonResponseIsRetur $authenticator->expects($this->once()) ->method('onAuthenticationFailure') ->with($this->request, $this->authenticationException) - ->will($this->returnValue(new \stdClass())); + ->willReturn(new \stdClass()); $handler = new SimpleAuthenticationHandler($authenticator, $this->successHandler, $this->failureHandler); $handler->onAuthenticationFailure($this->request, $this->authenticationException); @@ -172,13 +172,13 @@ public function testOnAuthenticationFailureFallsBackToDefaultHandlerIfNullIsRetu $this->failureHandler->expects($this->once()) ->method('onAuthenticationFailure') ->with($this->request, $this->authenticationException) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); $authenticator = $this->getMockForAbstractClass('Symfony\Component\Security\Http\Tests\TestFailureHandlerInterface'); $authenticator->expects($this->once()) ->method('onAuthenticationFailure') ->with($this->request, $this->authenticationException) - ->will($this->returnValue(null)); + ->willReturn(null); $handler = new SimpleAuthenticationHandler($authenticator, $this->successHandler, $this->failureHandler); $result = $handler->onAuthenticationFailure($this->request, $this->authenticationException); diff --git a/src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php b/src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php index 2e43f4ba63d6..999ff728bf46 100644 --- a/src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php @@ -29,7 +29,7 @@ public function testStart() ->expects($this->once()) ->method('createRedirectResponse') ->with($this->equalTo($request), $this->equalTo('/the/login/path')) - ->will($this->returnValue($response)) + ->willReturn($response) ; $entryPoint = new FormAuthenticationEntryPoint($httpKernel, $httpUtils, '/the/login/path', false); @@ -48,7 +48,7 @@ public function testStartWithUseForward() ->expects($this->once()) ->method('createRequest') ->with($this->equalTo($request), $this->equalTo('/the/login/path')) - ->will($this->returnValue($subRequest)) + ->willReturn($subRequest) ; $httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); @@ -56,7 +56,7 @@ public function testStartWithUseForward() ->expects($this->once()) ->method('handle') ->with($this->equalTo($subRequest), $this->equalTo(HttpKernelInterface::SUB_REQUEST)) - ->will($this->returnValue($response)) + ->willReturn($response) ; $entryPoint = new FormAuthenticationEntryPoint($httpKernel, $httpUtils, '/the/login/path', true); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php index 44bbf4423be5..c4ccdd6a69b2 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php @@ -31,7 +31,7 @@ public function testHandleWithValidValues() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $tokenStorage ->expects($this->once()) @@ -44,7 +44,7 @@ public function testHandleWithValidValues() ->expects($this->once()) ->method('authenticate') ->with($this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken')) - ->will($this->returnValue($token)) + ->willReturn($token) ; $listener = $this->getMockForAbstractClass('Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener', [ @@ -55,13 +55,13 @@ public function testHandleWithValidValues() $listener ->expects($this->once()) ->method('getPreAuthenticatedData') - ->will($this->returnValue($userCredentials)); + ->willReturn($userCredentials); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -77,7 +77,7 @@ public function testHandleWhenAuthenticationFails() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $tokenStorage ->expects($this->never()) @@ -101,13 +101,13 @@ public function testHandleWhenAuthenticationFails() $listener ->expects($this->once()) ->method('getPreAuthenticatedData') - ->will($this->returnValue($userCredentials)); + ->willReturn($userCredentials); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -125,7 +125,7 @@ public function testHandleWhenAuthenticationFailsWithDifferentToken() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)) + ->willReturn($token) ; $tokenStorage ->expects($this->never()) @@ -149,13 +149,13 @@ public function testHandleWhenAuthenticationFailsWithDifferentToken() $listener ->expects($this->once()) ->method('getPreAuthenticatedData') - ->will($this->returnValue($userCredentials)); + ->willReturn($userCredentials); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -173,7 +173,7 @@ public function testHandleWithASimilarAuthenticatedToken() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)) + ->willReturn($token) ; $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock(); @@ -190,13 +190,13 @@ public function testHandleWithASimilarAuthenticatedToken() $listener ->expects($this->once()) ->method('getPreAuthenticatedData') - ->will($this->returnValue($userCredentials)); + ->willReturn($userCredentials); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -214,7 +214,7 @@ public function testHandleWithAnInvalidSimilarToken() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)) + ->willReturn($token) ; $tokenStorage ->expects($this->once()) @@ -239,13 +239,13 @@ public function testHandleWithAnInvalidSimilarToken() $listener ->expects($this->once()) ->method('getPreAuthenticatedData') - ->will($this->returnValue($userCredentials)); + ->willReturn($userCredentials); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php index 92b2270877fb..0bb27258befe 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php @@ -28,21 +28,21 @@ public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess() ->expects($this->any()) ->method('getPatterns') ->with($this->equalTo($request)) - ->will($this->returnValue([['foo' => 'bar'], null])) + ->willReturn([['foo' => 'bar'], null]) ; $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token ->expects($this->any()) ->method('isAuthenticated') - ->will($this->returnValue(true)) + ->willReturn(true) ; $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)) + ->willReturn($token) ; $accessDecisionManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface')->getMock(); @@ -50,7 +50,7 @@ public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess() ->expects($this->once()) ->method('decide') ->with($this->equalTo($token), $this->equalTo(['foo' => 'bar']), $this->equalTo($request)) - ->will($this->returnValue(false)) + ->willReturn(false) ; $listener = new AccessListener( @@ -64,7 +64,7 @@ public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -79,21 +79,21 @@ public function testHandleWhenTheTokenIsNotAuthenticated() ->expects($this->any()) ->method('getPatterns') ->with($this->equalTo($request)) - ->will($this->returnValue([['foo' => 'bar'], null])) + ->willReturn([['foo' => 'bar'], null]) ; $notAuthenticatedToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $notAuthenticatedToken ->expects($this->any()) ->method('isAuthenticated') - ->will($this->returnValue(false)) + ->willReturn(false) ; $authenticatedToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $authenticatedToken ->expects($this->any()) ->method('isAuthenticated') - ->will($this->returnValue(true)) + ->willReturn(true) ; $authManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock(); @@ -101,14 +101,14 @@ public function testHandleWhenTheTokenIsNotAuthenticated() ->expects($this->once()) ->method('authenticate') ->with($this->equalTo($notAuthenticatedToken)) - ->will($this->returnValue($authenticatedToken)) + ->willReturn($authenticatedToken) ; $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($notAuthenticatedToken)) + ->willReturn($notAuthenticatedToken) ; $tokenStorage ->expects($this->once()) @@ -121,7 +121,7 @@ public function testHandleWhenTheTokenIsNotAuthenticated() ->expects($this->once()) ->method('decide') ->with($this->equalTo($authenticatedToken), $this->equalTo(['foo' => 'bar']), $this->equalTo($request)) - ->will($this->returnValue(true)) + ->willReturn(true) ; $listener = new AccessListener( @@ -135,7 +135,7 @@ public function testHandleWhenTheTokenIsNotAuthenticated() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -150,7 +150,7 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest() ->expects($this->any()) ->method('getPatterns') ->with($this->equalTo($request)) - ->will($this->returnValue([null, null])) + ->willReturn([null, null]) ; $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); @@ -163,7 +163,7 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)) + ->willReturn($token) ; $listener = new AccessListener( @@ -177,7 +177,7 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -192,7 +192,7 @@ public function testHandleWhenTheSecurityTokenStorageHasNoToken() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $listener = new AccessListener( diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php index f6f36415d37e..15b151a5cf82 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php @@ -23,7 +23,7 @@ public function testHandleWithTokenStorageHavingAToken() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()) ; $tokenStorage ->expects($this->never()) @@ -46,7 +46,7 @@ public function testHandleWithTokenStorageHavingNoToken() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $anonymousToken = new AnonymousToken('TheSecret', 'anon.', []); @@ -58,7 +58,7 @@ public function testHandleWithTokenStorageHavingNoToken() ->with($this->callback(function ($token) { return 'TheSecret' === $token->getSecret(); })) - ->will($this->returnValue($anonymousToken)) + ->willReturn($anonymousToken) ; $tokenStorage diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php index 2eec46b1d16a..e331542369f5 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php @@ -34,7 +34,7 @@ public function testHandleWithValidUsernameAndPasswordServerParameters() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $tokenStorage ->expects($this->once()) @@ -47,7 +47,7 @@ public function testHandleWithValidUsernameAndPasswordServerParameters() ->expects($this->once()) ->method('authenticate') ->with($this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken')) - ->will($this->returnValue($token)) + ->willReturn($token) ; $listener = new BasicAuthenticationListener( @@ -61,7 +61,7 @@ public function testHandleWithValidUsernameAndPasswordServerParameters() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -80,7 +80,7 @@ public function testHandleWhenAuthenticationFails() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $tokenStorage ->expects($this->never()) @@ -94,7 +94,7 @@ public function testHandleWhenAuthenticationFails() ->expects($this->any()) ->method('start') ->with($this->equalTo($request), $this->isInstanceOf('Symfony\Component\Security\Core\Exception\AuthenticationException')) - ->will($this->returnValue($response)) + ->willReturn($response) ; $listener = new BasicAuthenticationListener( @@ -108,7 +108,7 @@ public function testHandleWhenAuthenticationFails() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $event ->expects($this->once()) @@ -140,7 +140,7 @@ public function testHandleWithNoUsernameServerParameter() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -156,7 +156,7 @@ public function testHandleWithASimilarAuthenticatedToken() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)) + ->willReturn($token) ; $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface')->getMock(); @@ -176,7 +176,7 @@ public function testHandleWithASimilarAuthenticatedToken() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -209,7 +209,7 @@ public function testHandleWithADifferentAuthenticatedToken() $tokenStorage ->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)) + ->willReturn($token) ; $tokenStorage ->expects($this->never()) @@ -223,7 +223,7 @@ public function testHandleWithADifferentAuthenticatedToken() ->expects($this->any()) ->method('start') ->with($this->equalTo($request), $this->isInstanceOf('Symfony\Component\Security\Core\Exception\AuthenticationException')) - ->will($this->returnValue($response)) + ->willReturn($response) ; $listener = new BasicAuthenticationListener( @@ -237,7 +237,7 @@ public function testHandleWithADifferentAuthenticatedToken() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $event ->expects($this->once()) diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php index 3740faec8ba8..3511c629c1d4 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php @@ -23,7 +23,7 @@ public function testHandleWithNotSecuredRequestAndHttpChannel() $request ->expects($this->any()) ->method('isSecure') - ->will($this->returnValue(false)) + ->willReturn(false) ; $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock(); @@ -31,7 +31,7 @@ public function testHandleWithNotSecuredRequestAndHttpChannel() ->expects($this->any()) ->method('getPatterns') ->with($this->equalTo($request)) - ->will($this->returnValue([[], 'http'])) + ->willReturn([[], 'http']) ; $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock(); @@ -44,7 +44,7 @@ public function testHandleWithNotSecuredRequestAndHttpChannel() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $event ->expects($this->never()) @@ -61,7 +61,7 @@ public function testHandleWithSecuredRequestAndHttpsChannel() $request ->expects($this->any()) ->method('isSecure') - ->will($this->returnValue(true)) + ->willReturn(true) ; $accessMap = $this->getMockBuilder('Symfony\Component\Security\Http\AccessMapInterface')->getMock(); @@ -69,7 +69,7 @@ public function testHandleWithSecuredRequestAndHttpsChannel() ->expects($this->any()) ->method('getPatterns') ->with($this->equalTo($request)) - ->will($this->returnValue([[], 'https'])) + ->willReturn([[], 'https']) ; $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock(); @@ -82,7 +82,7 @@ public function testHandleWithSecuredRequestAndHttpsChannel() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $event ->expects($this->never()) @@ -99,7 +99,7 @@ public function testHandleWithNotSecuredRequestAndHttpsChannel() $request ->expects($this->any()) ->method('isSecure') - ->will($this->returnValue(false)) + ->willReturn(false) ; $response = new Response(); @@ -109,7 +109,7 @@ public function testHandleWithNotSecuredRequestAndHttpsChannel() ->expects($this->any()) ->method('getPatterns') ->with($this->equalTo($request)) - ->will($this->returnValue([[], 'https'])) + ->willReturn([[], 'https']) ; $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock(); @@ -117,14 +117,14 @@ public function testHandleWithNotSecuredRequestAndHttpsChannel() ->expects($this->once()) ->method('start') ->with($this->equalTo($request)) - ->will($this->returnValue($response)) + ->willReturn($response) ; $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $event ->expects($this->once()) @@ -142,7 +142,7 @@ public function testHandleWithSecuredRequestAndHttpChannel() $request ->expects($this->any()) ->method('isSecure') - ->will($this->returnValue(true)) + ->willReturn(true) ; $response = new Response(); @@ -152,7 +152,7 @@ public function testHandleWithSecuredRequestAndHttpChannel() ->expects($this->any()) ->method('getPatterns') ->with($this->equalTo($request)) - ->will($this->returnValue([[], 'http'])) + ->willReturn([[], 'http']) ; $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock(); @@ -160,14 +160,14 @@ public function testHandleWithSecuredRequestAndHttpChannel() ->expects($this->once()) ->method('start') ->with($this->equalTo($request)) - ->will($this->returnValue($response)) + ->willReturn($response) ; $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')->disableOriginalConstructor()->getMock(); $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $event ->expects($this->once()) diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php index 8df2f40acd11..250b26cfef6e 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php @@ -151,17 +151,17 @@ public function testInvalidTokenInSession($token) $event->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)); + ->willReturn($request); $request->expects($this->any()) ->method('hasPreviousSession') - ->will($this->returnValue(true)); + ->willReturn(true); $request->expects($this->any()) ->method('getSession') - ->will($this->returnValue($session)); + ->willReturn($session); $session->expects($this->any()) ->method('get') ->with('_security_key123') - ->will($this->returnValue($token)); + ->willReturn($token); $tokenStorage->expects($this->once()) ->method('setToken') ->with(null); @@ -193,10 +193,10 @@ public function testHandleAddsKernelResponseListener() $event->expects($this->any()) ->method('isMasterRequest') - ->will($this->returnValue(true)); + ->willReturn(true); $event->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock())); + ->willReturn($this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock()); $dispatcher->expects($this->once()) ->method('addListener') @@ -218,14 +218,14 @@ public function testOnKernelResponseListenerRemovesItself() $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); $request->expects($this->any()) ->method('hasSession') - ->will($this->returnValue(true)); + ->willReturn(true); $event->expects($this->any()) ->method('isMasterRequest') - ->will($this->returnValue(true)); + ->willReturn(true); $event->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)); + ->willReturn($request); $dispatcher->expects($this->once()) ->method('removeListener') @@ -237,12 +237,12 @@ public function testOnKernelResponseListenerRemovesItself() public function testHandleRemovesTokenIfNoPreviousSessionWasFound() { $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); - $request->expects($this->any())->method('hasPreviousSession')->will($this->returnValue(false)); + $request->expects($this->any())->method('hasPreviousSession')->willReturn(false); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent') ->disableOriginalConstructor() ->getMock(); - $event->expects($this->any())->method('getRequest')->will($this->returnValue($request)); + $event->expects($this->any())->method('getRequest')->willReturn($request); $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); $tokenStorage->expects($this->once())->method('setToken')->with(null); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestAuthenticationListenerTest.php index b5378902ea9f..5dbd2cd0feb5 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/DigestAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/DigestAuthenticationListenerTest.php @@ -47,7 +47,7 @@ public function testHandleWithValidDigest() $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $tokenStorage ->expects($this->once()) @@ -64,7 +64,7 @@ public function testHandleWithValidDigest() $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php index 53fedebcad70..1dda0ab968c7 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php @@ -77,7 +77,7 @@ public function testExceptionWhenEntryPointReturnsBadValue() $event = $this->createEvent(new AuthenticationException()); $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock(); - $entryPoint->expects($this->once())->method('start')->will($this->returnValue('NOT A RESPONSE')); + $entryPoint->expects($this->once())->method('start')->willReturn('NOT A RESPONSE'); $listener = $this->createExceptionListener(null, null, null, $entryPoint); $listener->onKernelException($event); @@ -106,12 +106,12 @@ public function testAccessDeniedExceptionFullFledgedAndWithoutAccessDeniedHandle public function testAccessDeniedExceptionFullFledgedAndWithoutAccessDeniedHandlerAndWithErrorPage(\Exception $exception, \Exception $eventException = null) { $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnValue(new Response('Unauthorized', 401))); + $kernel->expects($this->once())->method('handle')->willReturn(new Response('Unauthorized', 401)); $event = $this->createEvent($exception, $kernel); $httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock(); - $httpUtils->expects($this->once())->method('createRequest')->will($this->returnValue(Request::create('/error'))); + $httpUtils->expects($this->once())->method('createRequest')->willReturn(Request::create('/error')); $listener = $this->createExceptionListener(null, $this->createTrustResolver(true), $httpUtils, null, '/error'); $listener->onKernelException($event); @@ -131,7 +131,7 @@ public function testAccessDeniedExceptionFullFledgedAndWithAccessDeniedHandlerAn $event = $this->createEvent($exception); $accessDeniedHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface')->getMock(); - $accessDeniedHandler->expects($this->once())->method('handle')->will($this->returnValue(new Response('error'))); + $accessDeniedHandler->expects($this->once())->method('handle')->willReturn(new Response('error')); $listener = $this->createExceptionListener(null, $this->createTrustResolver(true), null, null, null, $accessDeniedHandler); $listener->onKernelException($event); @@ -148,7 +148,7 @@ public function testAccessDeniedExceptionNotFullFledged(\Exception $exception, \ $event = $this->createEvent($exception); $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(); - $tokenStorage->expects($this->once())->method('getToken')->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())); + $tokenStorage->expects($this->once())->method('getToken')->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()); $listener = $this->createExceptionListener($tokenStorage, $this->createTrustResolver(false), null, $this->createEntryPoint()); $listener->onKernelException($event); @@ -171,7 +171,7 @@ public function getAccessDeniedExceptionProvider() private function createEntryPoint(Response $response = null) { $entryPoint = $this->getMockBuilder('Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface')->getMock(); - $entryPoint->expects($this->once())->method('start')->will($this->returnValue($response ?: new Response('OK'))); + $entryPoint->expects($this->once())->method('start')->willReturn($response ?: new Response('OK')); return $entryPoint; } @@ -179,7 +179,7 @@ private function createEntryPoint(Response $response = null) private function createTrustResolver($fullFledged) { $trustResolver = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface')->getMock(); - $trustResolver->expects($this->once())->method('isFullFledged')->will($this->returnValue($fullFledged)); + $trustResolver->expects($this->once())->method('isFullFledged')->willReturn($fullFledged); return $trustResolver; } diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php index fbcea3d738e7..3796f871562c 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php @@ -30,7 +30,7 @@ public function testHandleUnmatchedPath() $httpUtils->expects($this->once()) ->method('checkRequestPath') ->with($request, $options['logout_path']) - ->will($this->returnValue(false)); + ->willReturn(false); $listener->handle($event); } @@ -49,20 +49,20 @@ public function testHandleMatchedPathWithSuccessHandlerAndCsrfValidation() $httpUtils->expects($this->once()) ->method('checkRequestPath') ->with($request, $options['logout_path']) - ->will($this->returnValue(true)); + ->willReturn(true); $tokenManager->expects($this->once()) ->method('isTokenValid') - ->will($this->returnValue(true)); + ->willReturn(true); $successHandler->expects($this->once()) ->method('onLogoutSuccess') ->with($request) - ->will($this->returnValue($response = new Response())); + ->willReturn($response = new Response()); $tokenStorage->expects($this->once()) ->method('getToken') - ->will($this->returnValue($token = $this->getToken())); + ->willReturn($token = $this->getToken()); $handler = $this->getHandler(); $handler->expects($this->once()) @@ -93,16 +93,16 @@ public function testHandleMatchedPathWithoutSuccessHandlerAndCsrfValidation() $httpUtils->expects($this->once()) ->method('checkRequestPath') ->with($request, $options['logout_path']) - ->will($this->returnValue(true)); + ->willReturn(true); $successHandler->expects($this->once()) ->method('onLogoutSuccess') ->with($request) - ->will($this->returnValue($response = new Response())); + ->willReturn($response = new Response()); $tokenStorage->expects($this->once()) ->method('getToken') - ->will($this->returnValue($token = $this->getToken())); + ->willReturn($token = $this->getToken()); $handler = $this->getHandler(); $handler->expects($this->once()) @@ -136,12 +136,12 @@ public function testSuccessHandlerReturnsNonResponse() $httpUtils->expects($this->once()) ->method('checkRequestPath') ->with($request, $options['logout_path']) - ->will($this->returnValue(true)); + ->willReturn(true); $successHandler->expects($this->once()) ->method('onLogoutSuccess') ->with($request) - ->will($this->returnValue(null)); + ->willReturn(null); $listener->handle($event); } @@ -162,11 +162,11 @@ public function testCsrfValidationFails() $httpUtils->expects($this->once()) ->method('checkRequestPath') ->with($request, $options['logout_path']) - ->will($this->returnValue(true)); + ->willReturn(true); $tokenManager->expects($this->once()) ->method('isTokenValid') - ->will($this->returnValue(false)); + ->willReturn(false); $listener->handle($event); } @@ -189,7 +189,7 @@ private function getGetResponseEvent() $event->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request = new Request())); + ->willReturn($request = new Request()); return [$event, $request]; } diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php index 686c7231e689..57d297103ec8 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php @@ -26,7 +26,7 @@ public function testOnCoreSecurityDoesNotTryToPopulateNonEmptyTokenStorage() $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()) ; $tokenStorage @@ -44,20 +44,20 @@ public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet() $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $service ->expects($this->once()) ->method('autoLogin') - ->will($this->returnValue(null)) + ->willReturn(null) ; $event = $this->getGetResponseEvent(); $event ->expects($this->once()) ->method('getRequest') - ->will($this->returnValue(new Request())) + ->willReturn(new Request()) ; $this->assertNull($listener->handle($event)); @@ -72,13 +72,13 @@ public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenti $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $service ->expects($this->once()) ->method('autoLogin') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()) ; $service @@ -97,7 +97,7 @@ public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenti $event ->expects($this->once()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -114,13 +114,13 @@ public function testOnCoreSecurityIgnoresAuthenticationOptionallyRethrowsExcepti $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $service ->expects($this->once()) ->method('autoLogin') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock()) ; $service @@ -139,7 +139,7 @@ public function testOnCoreSecurityIgnoresAuthenticationOptionallyRethrowsExcepti $event ->expects($this->once()) ->method('getRequest') - ->will($this->returnValue(new Request())) + ->willReturn(new Request()) ; $listener->handle($event); @@ -152,7 +152,7 @@ public function testOnCoreSecurityAuthenticationExceptionDuringAutoLoginTriggers $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $exception = new AuthenticationException('Authentication failed.'); @@ -176,7 +176,7 @@ public function testOnCoreSecurityAuthenticationExceptionDuringAutoLoginTriggers $event ->expects($this->once()) ->method('getRequest') - ->will($this->returnValue(new Request())) + ->willReturn(new Request()) ; $listener->handle($event); @@ -189,14 +189,14 @@ public function testOnCoreSecurity() $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $service ->expects($this->once()) ->method('autoLogin') - ->will($this->returnValue($token)) + ->willReturn($token) ; $tokenStorage @@ -208,14 +208,14 @@ public function testOnCoreSecurity() $manager ->expects($this->once()) ->method('authenticate') - ->will($this->returnValue($token)) + ->willReturn($token) ; $event = $this->getGetResponseEvent(); $event ->expects($this->once()) ->method('getRequest') - ->will($this->returnValue(new Request())) + ->willReturn(new Request()) ; $listener->handle($event); @@ -228,14 +228,14 @@ public function testSessionStrategy() $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $service ->expects($this->once()) ->method('autoLogin') - ->will($this->returnValue($token)) + ->willReturn($token) ; $tokenStorage @@ -247,40 +247,40 @@ public function testSessionStrategy() $manager ->expects($this->once()) ->method('authenticate') - ->will($this->returnValue($token)) + ->willReturn($token) ; $session = $this->getMockBuilder('\Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock(); $session ->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(true)) + ->willReturn(true) ; $request = $this->getMockBuilder('\Symfony\Component\HttpFoundation\Request')->getMock(); $request ->expects($this->once()) ->method('hasSession') - ->will($this->returnValue(true)) + ->willReturn(true) ; $request ->expects($this->once()) ->method('getSession') - ->will($this->returnValue($session)) + ->willReturn($session) ; $event = $this->getGetResponseEvent(); $event ->expects($this->once()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $sessionStrategy ->expects($this->once()) ->method('onAuthentication') - ->will($this->returnValue(null)) + ->willReturn(null) ; $listener->handle($event); @@ -293,14 +293,14 @@ public function testSessionIsMigratedByDefault() $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $service ->expects($this->once()) ->method('autoLogin') - ->will($this->returnValue($token)) + ->willReturn($token) ; $tokenStorage @@ -312,14 +312,14 @@ public function testSessionIsMigratedByDefault() $manager ->expects($this->once()) ->method('authenticate') - ->will($this->returnValue($token)) + ->willReturn($token) ; $session = $this->getMockBuilder('\Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock(); $session ->expects($this->once()) ->method('isStarted') - ->will($this->returnValue(true)) + ->willReturn(true) ; $session ->expects($this->once()) @@ -330,20 +330,20 @@ public function testSessionIsMigratedByDefault() $request ->expects($this->any()) ->method('hasSession') - ->will($this->returnValue(true)) + ->willReturn(true) ; $request ->expects($this->any()) ->method('getSession') - ->will($this->returnValue($session)) + ->willReturn($session) ; $event = $this->getGetResponseEvent(); $event ->expects($this->once()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -356,14 +356,14 @@ public function testOnCoreSecurityInteractiveLoginEventIsDispatchedIfDispatcherI $tokenStorage ->expects($this->once()) ->method('getToken') - ->will($this->returnValue(null)) + ->willReturn(null) ; $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $service ->expects($this->once()) ->method('autoLogin') - ->will($this->returnValue($token)) + ->willReturn($token) ; $tokenStorage @@ -375,7 +375,7 @@ public function testOnCoreSecurityInteractiveLoginEventIsDispatchedIfDispatcherI $manager ->expects($this->once()) ->method('authenticate') - ->will($this->returnValue($token)) + ->willReturn($token) ; $event = $this->getGetResponseEvent(); @@ -383,7 +383,7 @@ public function testOnCoreSecurityInteractiveLoginEventIsDispatchedIfDispatcherI $event ->expects($this->once()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $dispatcher diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php index 8739e1b62abb..1584b66ecee4 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php @@ -40,7 +40,7 @@ public function testHandle() ->expects($this->once()) ->method('authenticate') ->with($this->equalTo($this->token)) - ->will($this->returnValue($this->token)) + ->willReturn($this->token) ; $simpleAuthenticator = $this->getMockBuilder('Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface')->getMock(); @@ -48,7 +48,7 @@ public function testHandle() ->expects($this->once()) ->method('createToken') ->with($this->equalTo($this->request), $this->equalTo('secured_area')) - ->will($this->returnValue($this->token)) + ->willReturn($this->token) ; $loginEvent = new InteractiveLoginEvent($this->request, $this->token); @@ -85,7 +85,7 @@ public function testHandlecatchAuthenticationException() ->expects($this->once()) ->method('createToken') ->with($this->equalTo($this->request), $this->equalTo('secured_area')) - ->will($this->returnValue($this->token)) + ->willReturn($this->token) ; $listener = new SimplePreAuthenticationListener($this->tokenStorage, $this->authenticationManager, 'secured_area', $simpleAuthenticator, $this->logger, $this->dispatcher); @@ -108,7 +108,7 @@ protected function setUp() $this->event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($this->request)) + ->willReturn($this->request) ; $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php index 709bc4c862f9..2d22a91d6bde 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php @@ -167,7 +167,7 @@ public function testSwitchUserIsDisallowed() $this->accessDecisionManager->expects($this->once()) ->method('decide')->with($token, ['ROLE_ALLOWED_TO_SWITCH']) - ->will($this->returnValue(false)); + ->willReturn(false); $listener = new SwitchUserListener($this->tokenStorage, $this->userProvider, $this->userChecker, 'provider123', $this->accessDecisionManager); $listener->handle($this->event); @@ -183,11 +183,11 @@ public function testSwitchUser() $this->accessDecisionManager->expects($this->once()) ->method('decide')->with($token, ['ROLE_ALLOWED_TO_SWITCH']) - ->will($this->returnValue(true)); + ->willReturn(true); $this->userProvider->expects($this->once()) ->method('loadUserByUsername')->with('kuba') - ->will($this->returnValue($user)); + ->willReturn($user); $this->userChecker->expects($this->once()) ->method('checkPostAuth')->with($user); @@ -213,11 +213,11 @@ public function testSwitchUserKeepsOtherQueryStringParameters() $this->accessDecisionManager->expects($this->once()) ->method('decide')->with($token, ['ROLE_ALLOWED_TO_SWITCH']) - ->will($this->returnValue(true)); + ->willReturn(true); $this->userProvider->expects($this->once()) ->method('loadUserByUsername')->with('kuba') - ->will($this->returnValue($user)); + ->willReturn($user); $this->userChecker->expects($this->once()) ->method('checkPostAuth')->with($user); @@ -241,11 +241,11 @@ public function testSwitchUserWithReplacedToken() $this->accessDecisionManager->expects($this->any()) ->method('decide')->with($token, ['ROLE_ALLOWED_TO_SWITCH']) - ->will($this->returnValue(true)); + ->willReturn(true); $this->userProvider->expects($this->any()) ->method('loadUserByUsername')->with('kuba') - ->will($this->returnValue($user)); + ->willReturn($user); $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); $dispatcher @@ -288,11 +288,11 @@ public function testSwitchUserStateless() $this->accessDecisionManager->expects($this->once()) ->method('decide')->with($token, ['ROLE_ALLOWED_TO_SWITCH']) - ->will($this->returnValue(true)); + ->willReturn(true); $this->userProvider->expects($this->once()) ->method('loadUserByUsername')->with('kuba') - ->will($this->returnValue($user)); + ->willReturn($user); $this->userChecker->expects($this->once()) ->method('checkPostAuth')->with($user); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php index f1536db6d25a..61455745289d 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php @@ -38,21 +38,21 @@ public function testHandleWhenUsernameLength($username, $ok) $httpUtils ->expects($this->any()) ->method('checkRequestPath') - ->will($this->returnValue(true)) + ->willReturn(true) ; $failureHandler = $this->getMockBuilder('Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface')->getMock(); $failureHandler ->expects($ok ? $this->never() : $this->once()) ->method('onAuthenticationFailure') - ->will($this->returnValue(new Response())) + ->willReturn(new Response()) ; $authenticationManager = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager')->disableOriginalConstructor()->getMock(); $authenticationManager ->expects($ok ? $this->once() : $this->never()) ->method('authenticate') - ->will($this->returnValue(new Response())) + ->willReturn(new Response()) ; $listener = new UsernamePasswordFormAuthenticationListener( @@ -70,7 +70,7 @@ public function testHandleWhenUsernameLength($username, $ok) $event ->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)) + ->willReturn($request) ; $listener->handle($event); @@ -154,7 +154,7 @@ public function testHandleNonStringUsernameWith__toString($postOnly) $usernameClass ->expects($this->atLeastOnce()) ->method('__toString') - ->will($this->returnValue('someUsername')); + ->willReturn('someUsername'); $request = Request::create('/login_check', 'POST', ['_username' => $usernameClass]); $request->setSession($this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock()); diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php index ed7acfbe5d7a..7d2e55906b1d 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php @@ -43,7 +43,7 @@ private function createListener(array $options = [], $success = true, $matchChec $httpUtils ->expects($this->any()) ->method('checkRequestPath') - ->will($this->returnValue($matchCheckPath)) + ->willReturn($matchCheckPath) ; $authenticationManager = $this->getMockBuilder(AuthenticationManagerInterface::class)->getMock(); diff --git a/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php b/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php index 04fe3b4ea305..a8eb97192dc7 100644 --- a/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php +++ b/src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php @@ -28,7 +28,7 @@ public function testGetListeners() ->expects($this->once()) ->method('matches') ->with($this->equalTo($request)) - ->will($this->returnValue(false)) + ->willReturn(false) ; $map->add($notMatchingMatcher, [$this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock()]); @@ -38,7 +38,7 @@ public function testGetListeners() ->expects($this->once()) ->method('matches') ->with($this->equalTo($request)) - ->will($this->returnValue(true)) + ->willReturn(true) ; $theListener = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock(); $theException = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ExceptionListener')->disableOriginalConstructor()->getMock(); @@ -70,7 +70,7 @@ public function testGetListenersWithAnEntryHavingNoRequestMatcher() ->expects($this->once()) ->method('matches') ->with($this->equalTo($request)) - ->will($this->returnValue(false)) + ->willReturn(false) ; $map->add($notMatchingMatcher, [$this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock()]); @@ -105,7 +105,7 @@ public function testGetListenersWithNoMatchingEntry() ->expects($this->once()) ->method('matches') ->with($this->equalTo($request)) - ->will($this->returnValue(false)) + ->willReturn(false) ; $map->add($notMatchingMatcher, [$this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock()]); diff --git a/src/Symfony/Component/Security/Http/Tests/FirewallTest.php b/src/Symfony/Component/Security/Http/Tests/FirewallTest.php index 9113890b5e74..673a8be7139d 100644 --- a/src/Symfony/Component/Security/Http/Tests/FirewallTest.php +++ b/src/Symfony/Component/Security/Http/Tests/FirewallTest.php @@ -37,7 +37,7 @@ public function testOnKernelRequestRegistersExceptionListener() ->expects($this->once()) ->method('getListeners') ->with($this->equalTo($request)) - ->will($this->returnValue([[], $listener])) + ->willReturn([[], $listener]) ; $event = new GetResponseEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $request, HttpKernelInterface::MASTER_REQUEST); @@ -66,7 +66,7 @@ public function testOnKernelRequestStopsWhenThereIsAResponse() $map ->expects($this->once()) ->method('getListeners') - ->will($this->returnValue([[$first, $second], null])) + ->willReturn([[$first, $second], null]) ; $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent') @@ -81,7 +81,7 @@ public function testOnKernelRequestStopsWhenThereIsAResponse() $event ->expects($this->at(0)) ->method('hasResponse') - ->will($this->returnValue(true)) + ->willReturn(true) ; $firewall = new Firewall($map, $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock()); diff --git a/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php b/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php index 5368f4683c74..a4a76747e5a5 100644 --- a/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php +++ b/src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php @@ -92,12 +92,12 @@ public function testCreateRedirectResponseWithRouteName() ->expects($this->any()) ->method('generate') ->with('foobar', [], UrlGeneratorInterface::ABSOLUTE_URL) - ->will($this->returnValue('http://localhost/foo/bar')) + ->willReturn('http://localhost/foo/bar') ; $urlGenerator ->expects($this->any()) ->method('getContext') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock()) ; $response = $utils->createRedirectResponse($this->getRequest(), 'foobar'); @@ -125,12 +125,12 @@ public function testCreateRequestWithRouteName() $urlGenerator ->expects($this->once()) ->method('generate') - ->will($this->returnValue('/foo/bar')) + ->willReturn('/foo/bar') ; $urlGenerator ->expects($this->any()) ->method('getContext') - ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock())) + ->willReturn($this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock()) ; $subRequest = $utils->createRequest($this->getRequest(), 'foobar'); @@ -229,7 +229,7 @@ public function testCheckRequestPathWithUrlMatcherAndResourceFoundByUrl() ->expects($this->any()) ->method('match') ->with('/foo/bar') - ->will($this->returnValue(['_route' => 'foobar'])) + ->willReturn(['_route' => 'foobar']) ; $utils = new HttpUtils(null, $urlMatcher); @@ -244,7 +244,7 @@ public function testCheckRequestPathWithUrlMatcherAndResourceFoundByRequest() ->expects($this->any()) ->method('matchRequest') ->with($request) - ->will($this->returnValue(['_route' => 'foobar'])) + ->willReturn(['_route' => 'foobar']) ; $utils = new HttpUtils(null, $urlMatcher); @@ -323,7 +323,7 @@ private function getUrlGenerator($generatedUrl = '/foo/bar') $urlGenerator ->expects($this->any()) ->method('generate') - ->will($this->returnValue($generatedUrl)) + ->willReturn($generatedUrl) ; return $urlGenerator; diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php index 9936fc933957..926f8cc4b23a 100644 --- a/src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php @@ -26,7 +26,7 @@ public function testLogout() $httpUtils->expects($this->once()) ->method('createRedirectResponse') ->with($request, '/dashboard') - ->will($this->returnValue($response)); + ->willReturn($response); $handler = new DefaultLogoutSuccessHandler($httpUtils, '/dashboard'); $result = $handler->onLogoutSuccess($request); diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php index e32d46e3e577..cf25d1f77c82 100644 --- a/src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php @@ -28,7 +28,7 @@ public function testLogout() $request ->expects($this->once()) ->method('getSession') - ->will($this->returnValue($session)) + ->willReturn($session) ; $session diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php index 38b8474ffc38..ade199c0b922 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php @@ -51,7 +51,7 @@ public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserI $service ->expects($this->once()) ->method('processAutoLoginCookie') - ->will($this->returnValue(null)) + ->willReturn(null) ; $service->autoLogin($request); @@ -67,13 +67,13 @@ public function testAutoLogin() $user ->expects($this->once()) ->method('getRoles') - ->will($this->returnValue([])) + ->willReturn([]) ; $service ->expects($this->once()) ->method('processAutoLoginCookie') - ->will($this->returnValue($user)) + ->willReturn($user) ; $returnedToken = $service->autoLogin($request); @@ -131,7 +131,7 @@ public function testLoginSuccessIsNotProcessedWhenTokenDoesNotContainUserInterfa $token ->expects($this->once()) ->method('getUser') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $service @@ -154,13 +154,13 @@ public function testLoginSuccessIsNotProcessedWhenRememberMeIsNotRequested() $token ->expects($this->once()) ->method('getUser') - ->will($this->returnValue($account)) + ->willReturn($account) ; $service ->expects($this->never()) ->method('onLoginSuccess') - ->will($this->returnValue(null)) + ->willReturn(null) ; $this->assertFalse($request->request->has('foo')); @@ -178,13 +178,13 @@ public function testLoginSuccessWhenRememberMeAlwaysIsTrue() $token ->expects($this->once()) ->method('getUser') - ->will($this->returnValue($account)) + ->willReturn($account) ; $service ->expects($this->once()) ->method('onLoginSuccess') - ->will($this->returnValue(null)) + ->willReturn(null) ; $service->loginSuccess($request, $response, $token); @@ -205,13 +205,13 @@ public function testLoginSuccessWhenRememberMeParameterWithPathIsPositive($value $token ->expects($this->once()) ->method('getUser') - ->will($this->returnValue($account)) + ->willReturn($account) ; $service ->expects($this->once()) ->method('onLoginSuccess') - ->will($this->returnValue(true)) + ->willReturn(true) ; $service->loginSuccess($request, $response, $token); @@ -232,13 +232,13 @@ public function testLoginSuccessWhenRememberMeParameterIsPositive($value) $token ->expects($this->once()) ->method('getUser') - ->will($this->returnValue($account)) + ->willReturn($account) ; $service ->expects($this->once()) ->method('onLoginSuccess') - ->will($this->returnValue(true)) + ->willReturn(true) ; $service->loginSuccess($request, $response, $token); @@ -296,7 +296,7 @@ protected function getProvider() $provider ->expects($this->any()) ->method('supportsClass') - ->will($this->returnValue(true)) + ->willReturn(true) ; return $provider; diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php index 529b050c40b3..599a7e81c303 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php @@ -84,7 +84,7 @@ public function testAutoLoginReturnsNullOnNonExistentUser() $tokenProvider ->expects($this->once()) ->method('loadTokenBySeries') - ->will($this->returnValue(new PersistentToken('fooclass', 'fooname', 'fooseries', 'foovalue', new \DateTime()))) + ->willReturn(new PersistentToken('fooclass', 'fooname', 'fooseries', 'foovalue', new \DateTime())) ; $service->setTokenProvider($tokenProvider); @@ -111,14 +111,14 @@ public function testAutoLoginThrowsExceptionOnStolenCookieAndRemovesItFromThePer $tokenProvider ->expects($this->once()) ->method('loadTokenBySeries') - ->will($this->returnValue(new PersistentToken('fooclass', 'foouser', 'fooseries', 'anotherFooValue', new \DateTime()))) + ->willReturn(new PersistentToken('fooclass', 'foouser', 'fooseries', 'anotherFooValue', new \DateTime())) ; $tokenProvider ->expects($this->once()) ->method('deleteTokenBySeries') ->with($this->equalTo('fooseries')) - ->will($this->returnValue(null)) + ->willReturn(null) ; try { @@ -141,7 +141,7 @@ public function testAutoLoginDoesNotAcceptAnExpiredCookie() ->expects($this->once()) ->method('loadTokenBySeries') ->with($this->equalTo('fooseries')) - ->will($this->returnValue(new PersistentToken('fooclass', 'username', 'fooseries', 'foovalue', new \DateTime('yesterday')))) + ->willReturn(new PersistentToken('fooclass', 'username', 'fooseries', 'foovalue', new \DateTime('yesterday'))) ; $service->setTokenProvider($tokenProvider); @@ -155,7 +155,7 @@ public function testAutoLogin() $user ->expects($this->once()) ->method('getRoles') - ->will($this->returnValue(['ROLE_FOO'])) + ->willReturn(['ROLE_FOO']) ; $userProvider = $this->getProvider(); @@ -163,7 +163,7 @@ public function testAutoLogin() ->expects($this->once()) ->method('loadUserByUsername') ->with($this->equalTo('foouser')) - ->will($this->returnValue($user)) + ->willReturn($user) ; $service = $this->getService($userProvider, ['name' => 'foo', 'path' => null, 'domain' => null, 'secure' => false, 'httponly' => false, 'always_remember_me' => true, 'lifetime' => 3600]); @@ -175,7 +175,7 @@ public function testAutoLogin() ->expects($this->once()) ->method('loadTokenBySeries') ->with($this->equalTo('fooseries')) - ->will($this->returnValue(new PersistentToken('fooclass', 'foouser', 'fooseries', 'foovalue', new \DateTime()))) + ->willReturn(new PersistentToken('fooclass', 'foouser', 'fooseries', 'foovalue', new \DateTime())) ; $service->setTokenProvider($tokenProvider); @@ -200,7 +200,7 @@ public function testLogout() ->expects($this->once()) ->method('deleteTokenBySeries') ->with($this->equalTo('fooseries')) - ->will($this->returnValue(null)) + ->willReturn(null) ; $service->setTokenProvider($tokenProvider); @@ -276,13 +276,13 @@ public function testLoginSuccessSetsCookieWhenLoggedInWithNonRememberMeTokenInte $account ->expects($this->once()) ->method('getUsername') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); $token ->expects($this->any()) ->method('getUser') - ->will($this->returnValue($account)) + ->willReturn($account) ; $tokenProvider = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface')->getMock(); @@ -331,7 +331,7 @@ protected function getProvider() $provider ->expects($this->any()) ->method('supportsClass') - ->will($this->returnValue(true)) + ->willReturn(true) ; return $provider; diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php index 501d3850fa64..465636eb9f77 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php @@ -95,9 +95,9 @@ private function getEvent($request, $response, $type = HttpKernelInterface::MAST ->disableOriginalConstructor() ->getMock(); - $event->expects($this->any())->method('getRequest')->will($this->returnValue($request)); - $event->expects($this->any())->method('isMasterRequest')->will($this->returnValue(HttpKernelInterface::MASTER_REQUEST === $type)); - $event->expects($this->any())->method('getResponse')->will($this->returnValue($response)); + $event->expects($this->any())->method('getRequest')->willReturn($request); + $event->expects($this->any())->method('isMasterRequest')->willReturn(HttpKernelInterface::MASTER_REQUEST === $type); + $event->expects($this->any())->method('getResponse')->willReturn($response); return $event; } diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php index f0d938de8406..f24e4fff8080 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php @@ -67,14 +67,14 @@ public function testAutoLoginDoesNotAcceptCookieWithInvalidHash() $user ->expects($this->once()) ->method('getPassword') - ->will($this->returnValue('foopass')) + ->willReturn('foopass') ; $userProvider ->expects($this->once()) ->method('loadUserByUsername') ->with($this->equalTo('foouser')) - ->will($this->returnValue($user)) + ->willReturn($user) ; $this->assertNull($service->autoLogin($request)); @@ -92,14 +92,14 @@ public function testAutoLoginDoesNotAcceptAnExpiredCookie() $user ->expects($this->once()) ->method('getPassword') - ->will($this->returnValue('foopass')) + ->willReturn('foopass') ; $userProvider ->expects($this->once()) ->method('loadUserByUsername') ->with($this->equalTo('foouser')) - ->will($this->returnValue($user)) + ->willReturn($user) ; $this->assertNull($service->autoLogin($request)); @@ -117,12 +117,12 @@ public function testAutoLogin($username) $user ->expects($this->once()) ->method('getRoles') - ->will($this->returnValue(['ROLE_FOO'])) + ->willReturn(['ROLE_FOO']) ; $user ->expects($this->once()) ->method('getPassword') - ->will($this->returnValue('foopass')) + ->willReturn('foopass') ; $userProvider = $this->getProvider(); @@ -130,7 +130,7 @@ public function testAutoLogin($username) ->expects($this->once()) ->method('loadUserByUsername') ->with($this->equalTo($username)) - ->will($this->returnValue($user)) + ->willReturn($user) ; $service = $this->getService($userProvider, ['name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600]); @@ -191,7 +191,7 @@ public function testLoginSuccessIgnoresTokensWhichDoNotContainAnUserInterfaceImp $token ->expects($this->once()) ->method('getUser') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $cookies = $response->headers->getCookies(); @@ -214,17 +214,17 @@ public function testLoginSuccess() $user ->expects($this->once()) ->method('getPassword') - ->will($this->returnValue('foopass')) + ->willReturn('foopass') ; $user ->expects($this->once()) ->method('getUsername') - ->will($this->returnValue('foouser')) + ->willReturn('foouser') ; $token ->expects($this->atLeastOnce()) ->method('getUser') - ->will($this->returnValue($user)) + ->willReturn($user) ; $cookies = $response->headers->getCookies(); @@ -277,7 +277,7 @@ protected function getProvider() $provider ->expects($this->any()) ->method('supportsClass') - ->will($this->returnValue(true)) + ->willReturn(true) ; return $provider; diff --git a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php index 271bc99cc5ba..6c0df8cb5f2c 100644 --- a/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php @@ -61,7 +61,7 @@ private function getRequest($session = null) $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); if (null !== $session) { - $request->expects($this->any())->method('getSession')->will($this->returnValue($session)); + $request->expects($this->any())->method('getSession')->willReturn($session); } return $request; diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php index 3a84d99dde28..22b86758a590 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php @@ -32,12 +32,12 @@ protected function setUp() $this->decoder1 ->method('supportsDecoding') - ->will($this->returnValueMap([ + ->willReturnMap([ [self::FORMAT_1, [], true], [self::FORMAT_2, [], false], [self::FORMAT_3, [], false], [self::FORMAT_3, ['foo' => 'bar'], true], - ])); + ]); $this->decoder2 = $this ->getMockBuilder('Symfony\Component\Serializer\Encoder\DecoderInterface') @@ -45,11 +45,11 @@ protected function setUp() $this->decoder2 ->method('supportsDecoding') - ->will($this->returnValueMap([ + ->willReturnMap([ [self::FORMAT_1, [], false], [self::FORMAT_2, [], true], [self::FORMAT_3, [], false], - ])); + ]); $this->chainDecoder = new ChainDecoder([$this->decoder1, $this->decoder2]); } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php index 48ccbdca0aca..d9b6251ed93c 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php @@ -34,12 +34,12 @@ protected function setUp() $this->encoder1 ->method('supportsEncoding') - ->will($this->returnValueMap([ + ->willReturnMap([ [self::FORMAT_1, [], true], [self::FORMAT_2, [], false], [self::FORMAT_3, [], false], [self::FORMAT_3, ['foo' => 'bar'], true], - ])); + ]); $this->encoder2 = $this ->getMockBuilder('Symfony\Component\Serializer\Encoder\EncoderInterface') @@ -47,11 +47,11 @@ protected function setUp() $this->encoder2 ->method('supportsEncoding') - ->will($this->returnValueMap([ + ->willReturnMap([ [self::FORMAT_1, [], false], [self::FORMAT_2, [], true], [self::FORMAT_3, [], false], - ])); + ]); $this->chainEncoder = new ChainEncoder([$this->encoder1, $this->encoder2]); } diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php index cac4367ca799..067f16acf9c3 100644 --- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php +++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php @@ -31,7 +31,7 @@ public function testGetMetadataFor() $decorated ->expects($this->once()) ->method('getMetadataFor') - ->will($this->returnValue($metadata)) + ->willReturn($metadata) ; $factory = new CacheClassMetadataFactory($decorated, new ArrayAdapter()); @@ -47,7 +47,7 @@ public function testHasMetadataFor() $decorated ->expects($this->once()) ->method('hasMetadataFor') - ->will($this->returnValue(true)) + ->willReturn(true) ; $factory = new CacheClassMetadataFactory($decorated, new ArrayAdapter()); diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php index 3d2aaa4c7ccd..4e32085c9845 100644 --- a/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php +++ b/src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php @@ -55,7 +55,7 @@ public function testCacheExists() $cache ->expects($this->once()) ->method('fetch') - ->will($this->returnValue('foo')) + ->willReturn('foo') ; $factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()), $cache); @@ -68,7 +68,7 @@ public function testCacheExists() public function testCacheNotExists() { $cache = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock(); - $cache->method('fetch')->will($this->returnValue(false)); + $cache->method('fetch')->willReturn(false); $cache->method('save'); $factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()), $cache); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php index fd456cb9dd4d..132f3c080635 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php @@ -39,12 +39,12 @@ public function testDenormalize() $this->serializer->expects($this->at(0)) ->method('denormalize') ->with(['foo' => 'one', 'bar' => 'two']) - ->will($this->returnValue(new ArrayDummy('one', 'two'))); + ->willReturn(new ArrayDummy('one', 'two')); $this->serializer->expects($this->at(1)) ->method('denormalize') ->with(['foo' => 'three', 'bar' => 'four']) - ->will($this->returnValue(new ArrayDummy('three', 'four'))); + ->willReturn(new ArrayDummy('three', 'four')); $result = $this->denormalizer->denormalize( [ @@ -68,7 +68,7 @@ public function testSupportsValidArray() $this->serializer->expects($this->once()) ->method('supportsDenormalization') ->with($this->anything(), __NAMESPACE__.'\ArrayDummy', $this->anything()) - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertTrue( $this->denormalizer->supportsDenormalization( @@ -85,7 +85,7 @@ public function testSupportsInvalidArray() { $this->serializer->expects($this->any()) ->method('supportsDenormalization') - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertFalse( $this->denormalizer->supportsDenormalization( diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index 894801747540..d92fad3f8097 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -63,7 +63,7 @@ public function testNormalize() ->expects($this->once()) ->method('normalize') ->with($object, 'any') - ->will($this->returnValue('string_object')) + ->willReturn('string_object') ; $this->assertEquals( diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php index c6b167cbbe13..4d9a53eeb937 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php @@ -50,11 +50,11 @@ public function testNormalize() $this->serializer ->expects($this->once()) ->method('normalize') - ->will($this->returnCallback(function ($data) { + ->willReturnCallback(function ($data) { $this->assertArraySubset(['foo' => 'a', 'bar' => 'b', 'baz' => 'c'], $data); return 'string_object'; - })) + }) ; $this->assertEquals('string_object', $this->normalizer->normalize(new JsonSerializableDummy())); @@ -70,11 +70,11 @@ public function testCircularNormalize() $this->serializer ->expects($this->once()) ->method('normalize') - ->will($this->returnCallback(function ($data, $format, $context) { + ->willReturnCallback(function ($data, $format, $context) { $this->normalizer->normalize($data['qux'], $format, $context); return 'string_object'; - })) + }) ; $this->assertEquals('string_object', $this->normalizer->normalize(new JsonSerializableDummy())); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index b30739714b66..fe9d0b854609 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -65,7 +65,7 @@ public function testNormalize() ->expects($this->once()) ->method('normalize') ->with($object, 'any') - ->will($this->returnValue('string_object')) + ->willReturn('string_object') ; $this->assertEquals( diff --git a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php index 875672d27fff..3d61ec2716b5 100644 --- a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php +++ b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php @@ -26,7 +26,7 @@ public function testRenderDelegatesToSupportedEngine() $secondEngine->expects($this->once()) ->method('render') ->with('template.php', ['foo' => 'bar']) - ->will($this->returnValue('')); + ->willReturn(''); $delegatingEngine = new DelegatingEngine([$firstEngine, $secondEngine]); $result = $delegatingEngine->render('template.php', ['foo' => 'bar']); @@ -53,7 +53,7 @@ public function testStreamDelegatesToSupportedEngine() $streamingEngine->expects($this->once()) ->method('stream') ->with('template.php', ['foo' => 'bar']) - ->will($this->returnValue('')); + ->willReturn(''); $delegatingEngine = new DelegatingEngine([$streamingEngine]); $result = $delegatingEngine->stream('template.php', ['foo' => 'bar']); @@ -77,7 +77,7 @@ public function testExists() $engine->expects($this->once()) ->method('exists') ->with('template.php') - ->will($this->returnValue(true)); + ->willReturn(true); $delegatingEngine = new DelegatingEngine([$engine]); @@ -132,7 +132,7 @@ private function getEngineMock($template, $supports) $engine->expects($this->once()) ->method('supports') ->with($template) - ->will($this->returnValue($supports)); + ->willReturn($supports); return $engine; } @@ -144,7 +144,7 @@ private function getStreamingEngineMock($template, $supports) $engine->expects($this->once()) ->method('supports') ->with($template) - ->will($this->returnValue($supports)); + ->willReturn($supports); return $engine; } diff --git a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php index b4d350ef862e..bd97a2445c0a 100644 --- a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php +++ b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php @@ -27,7 +27,7 @@ protected function setUp() public function testCollectEmptyMessages() { $translator = $this->getTranslator(); - $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue([])); + $translator->expects($this->any())->method('getCollectedMessages')->willReturn([]); $dataCollector = new TranslationDataCollector($translator); $dataCollector->lateCollect(); @@ -125,7 +125,7 @@ public function testCollect() ]; $translator = $this->getTranslator(); - $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue($collectedMessages)); + $translator->expects($this->any())->method('getCollectedMessages')->willReturn($collectedMessages); $dataCollector = new TranslationDataCollector($translator); $dataCollector->lateCollect(); diff --git a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php index 433be2eeaf45..0f9c8d684e3b 100644 --- a/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php +++ b/src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php @@ -84,10 +84,10 @@ public function testReplace() public function testAddCatalogue() { $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); + $r->expects($this->any())->method('__toString')->willReturn('r'); $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); + $r1->expects($this->any())->method('__toString')->willReturn('r1'); $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); $catalogue->addResource($r); @@ -106,13 +106,13 @@ public function testAddCatalogue() public function testAddFallbackCatalogue() { $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); + $r->expects($this->any())->method('__toString')->willReturn('r'); $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); + $r1->expects($this->any())->method('__toString')->willReturn('r1'); $r2 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r2->expects($this->any())->method('__toString')->will($this->returnValue('r2')); + $r2->expects($this->any())->method('__toString')->willReturn('r2'); $catalogue = new MessageCatalogue('fr_FR', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); $catalogue->addResource($r); @@ -171,11 +171,11 @@ public function testGetAddResource() { $catalogue = new MessageCatalogue('en'); $r = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r->expects($this->any())->method('__toString')->will($this->returnValue('r')); + $r->expects($this->any())->method('__toString')->willReturn('r'); $catalogue->addResource($r); $catalogue->addResource($r); $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); - $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); + $r1->expects($this->any())->method('__toString')->willReturn('r1'); $catalogue->addResource($r1); $this->assertEquals([$r, $r1], $catalogue->getResources()); diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php index 6c94e14c54ba..0213e2225478 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php @@ -100,7 +100,7 @@ public function testCatalogueIsReloadedWhenResourcesAreNoLongerFresh() $loader ->expects($this->exactly(2)) ->method('load') - ->will($this->returnValue($catalogue)) + ->willReturn($catalogue) ; // 1st pass @@ -242,11 +242,11 @@ public function testRefreshCacheWhenResourcesAreNoLongerFresh() { $resource = $this->getMockBuilder('Symfony\Component\Config\Resource\SelfCheckingResourceInterface')->getMock(); $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock(); - $resource->method('isFresh')->will($this->returnValue(false)); + $resource->method('isFresh')->willReturn(false); $loader ->expects($this->exactly(2)) ->method('load') - ->will($this->returnValue($this->getCatalogue('fr', [], [$resource]))); + ->willReturn($this->getCatalogue('fr', [], [$resource])); // prime the cache $translator = new Translator('fr', null, $this->tmpDir, true); diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php index f07adb94238f..0a11c4741385 100644 --- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php @@ -109,7 +109,7 @@ protected function createContext() $validator->expects($this->any()) ->method('inContext') ->with($context) - ->will($this->returnValue($contextualValidator)); + ->willReturn($contextualValidator); return $context; } @@ -174,7 +174,7 @@ protected function expectValidateAt($i, $propertyPath, $value, $group) $validator->expects($this->at(2 * $i)) ->method('atPath') ->with($propertyPath) - ->will($this->returnValue($validator)); + ->willReturn($validator); $validator->expects($this->at(2 * $i + 1)) ->method('validate') ->with($value, $this->logicalOr(null, [], $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group); @@ -186,7 +186,7 @@ protected function expectValidateValueAt($i, $propertyPath, $value, $constraints $contextualValidator->expects($this->at(2 * $i)) ->method('atPath') ->with($propertyPath) - ->will($this->returnValue($contextualValidator)); + ->willReturn($contextualValidator); $contextualValidator->expects($this->at(2 * $i + 1)) ->method('validate') ->with($value, $constraints, $group); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php index 5cffcefd5272..72ca333d3c0a 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php @@ -258,11 +258,11 @@ public function testExpressionLanguageUsage() $used = false; $expressionLanguage->method('evaluate') - ->will($this->returnCallback(function () use (&$used) { + ->willReturnCallback(function () use (&$used) { $used = true; return true; - })); + }); $validator = new ExpressionValidator(null, $expressionLanguage); $validator->initialize($this->createContext()); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php index b3428e77828c..65906c5539fe 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php @@ -291,11 +291,11 @@ public function testValidMimeType() $file ->expects($this->once()) ->method('getPathname') - ->will($this->returnValue($this->path)); + ->willReturn($this->path); $file ->expects($this->once()) ->method('getMimeType') - ->will($this->returnValue('image/jpg')); + ->willReturn('image/jpg'); $constraint = new File([ 'mimeTypes' => ['image/png', 'image/jpg'], @@ -315,11 +315,11 @@ public function testValidWildcardMimeType() $file ->expects($this->once()) ->method('getPathname') - ->will($this->returnValue($this->path)); + ->willReturn($this->path); $file ->expects($this->once()) ->method('getMimeType') - ->will($this->returnValue('image/jpg')); + ->willReturn('image/jpg'); $constraint = new File([ 'mimeTypes' => ['image/*'], @@ -339,11 +339,11 @@ public function testInvalidMimeType() $file ->expects($this->once()) ->method('getPathname') - ->will($this->returnValue($this->path)); + ->willReturn($this->path); $file ->expects($this->once()) ->method('getMimeType') - ->will($this->returnValue('application/pdf')); + ->willReturn('application/pdf'); $constraint = new File([ 'mimeTypes' => ['image/png', 'image/jpg'], @@ -369,11 +369,11 @@ public function testInvalidWildcardMimeType() $file ->expects($this->once()) ->method('getPathname') - ->will($this->returnValue($this->path)); + ->willReturn($this->path); $file ->expects($this->once()) ->method('getMimeType') - ->will($this->returnValue('application/pdf')); + ->willReturn('application/pdf'); $constraint = new File([ 'mimeTypes' => ['image/*', 'image/jpg'], diff --git a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php index 3782fba46c3b..5178bc3b3060 100644 --- a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php +++ b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php @@ -54,7 +54,7 @@ public function testGetInstanceInvalidValidatorClass() $constraint ->expects($this->once()) ->method('validatedBy') - ->will($this->returnValue('Fully\\Qualified\\ConstraintValidator\\Class\\Name')); + ->willReturn('Fully\\Qualified\\ConstraintValidator\\Class\\Name'); $factory = new ContainerConstraintValidatorFactory(new Container()); $factory->getInstance($constraint); diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Cache/AbstractCacheTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Cache/AbstractCacheTest.php index 4d0363fd717b..bd088e0f093d 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Cache/AbstractCacheTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Cache/AbstractCacheTest.php @@ -31,7 +31,7 @@ public function testWrite() $meta->expects($this->once()) ->method('getClassName') - ->will($this->returnValue('Foo\\Bar')); + ->willReturn('Foo\\Bar'); $this->cache->write($meta); @@ -51,7 +51,7 @@ public function testHas() $meta->expects($this->once()) ->method('getClassName') - ->will($this->returnValue('Foo\\Bar')); + ->willReturn('Foo\\Bar'); $this->assertFalse($this->cache->has('Foo\\Bar'), 'has() returns false when there is no entry'); @@ -68,7 +68,7 @@ public function testRead() $meta->expects($this->once()) ->method('getClassName') - ->will($this->returnValue('Foo\\Bar')); + ->willReturn('Foo\\Bar'); $this->assertFalse($this->cache->read('Foo\\Bar'), 'read() returns false when there is no entry'); diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php index a7876d7f9168..9ad85e3f904f 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php @@ -97,7 +97,7 @@ public function testWriteMetadataToCache() [$this->equalTo(self::PARENT_CLASS)], [$this->equalTo(self::INTERFACE_A_CLASS)] ) - ->will($this->returnValue(false)); + ->willReturn(false); $cache->expects($this->exactly(2)) ->method('write') ->withConsecutive( @@ -172,12 +172,12 @@ public function testMetadataCacheWithRuntimeConstraint() $cache ->expects($this->any()) ->method('write') - ->will($this->returnCallback(function ($metadata) { serialize($metadata); })) + ->willReturnCallback(function ($metadata) { serialize($metadata); }) ; $cache->expects($this->any()) ->method('read') - ->will($this->returnValue(false)); + ->willReturn(false); $metadata = $factory->getMetadataFor(self::PARENT_CLASS); $metadata->addConstraint(new Callback(function () {})); diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php index f9905386c960..45b8576f0e16 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php @@ -46,12 +46,12 @@ public function testReturnsTrueIfAnyLoaderReturnedTrue() $loader1 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock(); $loader1->expects($this->any()) ->method('loadClassMetadata') - ->will($this->returnValue(true)); + ->willReturn(true); $loader2 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock(); $loader2->expects($this->any()) ->method('loadClassMetadata') - ->will($this->returnValue(false)); + ->willReturn(false); $chain = new LoaderChain([ $loader1, @@ -68,12 +68,12 @@ public function testReturnsFalseIfNoLoaderReturnedTrue() $loader1 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock(); $loader1->expects($this->any()) ->method('loadClassMetadata') - ->will($this->returnValue(false)); + ->willReturn(false); $loader2 = $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock(); $loader2->expects($this->any()) ->method('loadClassMetadata') - ->will($this->returnValue(false)); + ->willReturn(false); $chain = new LoaderChain([ $loader1, diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php index 1df64de4d99c..2bc3d11ef6d4 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php @@ -610,9 +610,9 @@ public function testInitializeObjectsOnFirstValidation() $initializer1->expects($this->once()) ->method('initialize') ->with($entity) - ->will($this->returnCallback(function ($object) { + ->willReturnCallback(function ($object) { $object->initialized = true; - })); + }); $initializer2->expects($this->once()) ->method('initialize') diff --git a/src/Symfony/Component/Workflow/Tests/RegistryTest.php b/src/Symfony/Component/Workflow/Tests/RegistryTest.php index 25d2e1cc3b5e..adedfc93b74d 100644 --- a/src/Symfony/Component/Workflow/Tests/RegistryTest.php +++ b/src/Symfony/Component/Workflow/Tests/RegistryTest.php @@ -92,9 +92,9 @@ private function createSupportStrategy($supportedClassName) { $strategy = $this->getMockBuilder(SupportStrategyInterface::class)->getMock(); $strategy->expects($this->any())->method('supports') - ->will($this->returnCallback(function ($workflow, $subject) use ($supportedClassName) { + ->willReturnCallback(function ($workflow, $subject) use ($supportedClassName) { return $subject instanceof $supportedClassName; - })); + }); return $strategy; }