Skip to content
Permalink
Browse files

Merge branch '3.4' into 4.2

* 3.4:
  Use willReturn() instead of will(returnValue()).
  • Loading branch information...
nicolas-grekas committed May 30, 2019
2 parents 6892c30 + 3cd3522 commit 06c655251ca2624710f70d6a12ade20c4c7fb1f1
Showing with 1,164 additions and 1,166 deletions.
  1. +0 −2 .php_cs.dist
  2. +4 −4 src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php
  3. +2 −2 src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
  4. +11 −11 src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php
  5. +2 −2 src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
  6. +2 −2 src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
  7. +1 −1 src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
  8. +12 −12 src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
  9. +4 −4 src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
  10. +2 −2 src/Symfony/Bridge/Monolog/Tests/Processor/WebProcessorTest.php
  11. +4 −4 src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php
  12. +1 −1 src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php
  13. +3 −3 src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php
  14. +4 −4 src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php
  15. +11 −11 src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
  16. +14 −14 src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
  17. +5 −5 src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php
  18. +5 −5 src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
  19. +1 −1 src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php
  20. +5 −5 src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php
  21. +8 −8 src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php
  22. +6 −6 src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php
  23. +4 −4 src/Symfony/Bundle/FrameworkBundle/Tests/Templating/DelegatingEngineTest.php
  24. +3 −3 src/Symfony/Bundle/FrameworkBundle/Tests/Templating/GlobalVariablesTest.php
  25. +1 −1 src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php
  26. +2 −2 src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
  27. +3 −3 src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php
  28. +15 −15 src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php
  29. +3 −3 src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Security/Factory/AbstractFactoryTest.php
  30. +1 −1 src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php
  31. +5 −5 src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php
  32. +4 −4 src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php
  33. +3 −3 src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
  34. +1 −1 src/Symfony/Bundle/WebProfilerBundle/Tests/Csp/ContentSecurityPolicyHandlerTest.php
  35. +5 −5 src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php
  36. +3 −3 src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php
  37. +1 −1 src/Symfony/Component/Asset/Tests/PathPackageTest.php
  38. +1 −1 src/Symfony/Component/Asset/Tests/UrlPackageTest.php
  39. +2 −2 src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
  40. +2 −2 src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php
  41. +2 −2 src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php
  42. +4 −4 src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php
  43. +1 −1 src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php
  44. +6 −6 src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
  45. +2 −2 src/Symfony/Component/Console/Tests/ApplicationTest.php
  46. +1 −1 src/Symfony/Component/Console/Tests/Command/CommandTest.php
  47. +1 −1 src/Symfony/Component/Console/Tests/Helper/AbstractQuestionHelperTest.php
  48. +1 −1 src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
  49. +1 −1 src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
  50. +1 −1 src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
  51. +1 −1 src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php
  52. +5 −5 src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
  53. +6 −6 src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
  54. +2 −2 src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php
  55. +2 −2 src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
  56. +2 −2 src/Symfony/Component/DomCrawler/Tests/FormTest.php
  57. +3 −3 src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php
  58. +8 −8 src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php
  59. +1 −1 src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
  60. +2 −2 src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
  61. +1 −1 src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
  62. +37 −37 src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php
  63. +36 −36 src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php
  64. +13 −13 src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php
  65. +21 −21 src/Symfony/Component/Form/Tests/CompoundFormTest.php
  66. +4 −4 src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php
  67. +8 −8 src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
  68. +53 −53 src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php
  69. +4 −4 src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php
  70. +1 −1 src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php
  71. +4 −4 src/Symfony/Component/Form/Tests/FormBuilderTest.php
  72. +50 −50 src/Symfony/Component/Form/Tests/FormFactoryTest.php
  73. +20 −20 src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
  74. +4 −4 src/Symfony/Component/Form/Tests/SimpleFormTest.php
  75. +1 −1 src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
  76. +3 −3 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
  77. +14 −14 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php
  78. +13 −13 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
  79. +5 −5 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
  80. +4 −4 src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
  81. +1 −1 src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php
  82. +2 −2 src/Symfony/Component/HttpKernel/Tests/ClientTest.php
  83. +1 −1 src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php
  84. +12 −12 src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
  85. +6 −6 src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php
  86. +1 −1 src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php
  87. +4 −4 src/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php
  88. +4 −4 src/Symfony/Component/HttpKernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php
  89. +1 −1 src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php
  90. +1 −1 src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php
  91. +6 −6 src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php
  92. +3 −3 src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
  93. +1 −1 src/Symfony/Component/HttpKernel/Tests/EventListener/ProfilerListenerTest.php
  94. +4 −4 src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
  95. +6 −6 src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php
  96. +1 −1 src/Symfony/Component/HttpKernel/Tests/EventListener/TranslatorListenerTest.php
  97. +2 −2 src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
  98. +3 −3 src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
  99. +2 −2 src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
  100. +2 −2 src/Symfony/Component/HttpKernel/Tests/HttpCache/SsiTest.php
  101. +2 −2 src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php
  102. +15 −15 src/Symfony/Component/HttpKernel/Tests/KernelTest.php
  103. +1 −1 src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php
  104. +29 −29 src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php
  105. +1 −1 src/Symfony/Component/Ldap/Tests/LdapTest.php
  106. +8 −8 src/Symfony/Component/Messenger/Tests/MessageBusTest.php
  107. +2 −2 src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php
  108. +13 −13 src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
  109. +3 −3 src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
  110. +3 −3 src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php
  111. +5 −5 src/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
  112. +1 −1 src/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php
  113. +1 −1 src/Symfony/Component/Routing/Tests/Loader/ObjectRouteLoaderTest.php
  114. +9 −9 src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
  115. +9 −9 src/Symfony/Component/Routing/Tests/RouteCollectionBuilderTest.php
  116. +3 −3 src/Symfony/Component/Routing/Tests/RouterTest.php
  117. +2 −2 src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationProviderManagerTest.php
  118. +1 −1 ...ony/Component/Security/Core/Tests/Authentication/Provider/AnonymousAuthenticationProviderTest.php
  119. +18 −18 src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php
  120. +5 −5 ...fony/Component/Security/Core/Tests/Authentication/Provider/LdapBindAuthenticationProviderTest.php
  121. +6 −6 ...ponent/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php
  122. +3 −3 ...ny/Component/Security/Core/Tests/Authentication/Provider/RememberMeAuthenticationProviderTest.php
  123. +6 −6 ...ymfony/Component/Security/Core/Tests/Authentication/Provider/SimpleAuthenticationProviderTest.php
  124. +14 −14 src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php
  125. +1 −1 src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php
  126. +1 −1 src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememberMeTokenTest.php
  127. +3 −3 src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php
  128. +4 −4 src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php
  129. +2 −2 src/Symfony/Component/Security/Core/Tests/Authorization/Voter/ExpressionVoterTest.php
  130. +1 −1 src/Symfony/Component/Security/Core/Tests/Authorization/Voter/RoleVoterTest.php
  131. +7 −7 src/Symfony/Component/Security/Core/Tests/Encoder/UserPasswordEncoderTest.php
  132. +7 −7 src/Symfony/Component/Security/Core/Tests/SecurityTest.php
  133. +8 −8 src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php
  134. +43 −43 src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php
  135. +11 −11 src/Symfony/Component/Security/Core/Tests/User/UserCheckerTest.php
  136. +7 −7 src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php
  137. +11 −11 src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php
  138. +10 −10 src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php
  139. +4 −4 src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
  140. +9 −9 src/Symfony/Component/Security/Guard/Tests/Provider/GuardAuthenticationProviderTest.php
  141. +1 −1 src/Symfony/Component/Security/Http/Tests/AccessMapTest.php
  142. +9 −9 src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
  143. +2 −2 src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
  144. +10 −10 src/Symfony/Component/Security/Http/Tests/Authentication/SimpleAuthenticationHandlerTest.php
  145. +3 −3 src/Symfony/Component/Security/Http/Tests/EntryPoint/FormAuthenticationEntryPointTest.php
  146. +16 −16 src/Symfony/Component/Security/Http/Tests/Firewall/AbstractPreAuthenticatedListenerTest.php
  147. +16 −16 src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
  148. +3 −3 src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
  149. +12 −12 src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
  150. +14 −14 src/Symfony/Component/Security/Http/Tests/Firewall/ChannelListenerTest.php
  151. +11 −11 src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php
  152. +7 −7 src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php
  153. +13 −13 src/Symfony/Component/Security/Http/Tests/Firewall/LogoutListenerTest.php
  154. +35 −35 src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
  155. +4 −4 src/Symfony/Component/Security/Http/Tests/Firewall/SimplePreAuthenticationListenerTest.php
  156. +9 −9 src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
  157. +5 −5 ...Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php
  158. +1 −1 ...Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
  159. +4 −4 src/Symfony/Component/Security/Http/Tests/FirewallMapTest.php
  160. +3 −3 src/Symfony/Component/Security/Http/Tests/FirewallTest.php
  161. +7 −7 src/Symfony/Component/Security/Http/Tests/HttpUtilsTest.php
  162. +1 −1 src/Symfony/Component/Security/Http/Tests/Logout/DefaultLogoutSuccessHandlerTest.php
  163. +1 −1 src/Symfony/Component/Security/Http/Tests/Logout/SessionLogoutHandlerTest.php
  164. +13 −13 src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
  165. +11 −11 src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
  166. +3 −3 src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php
  167. +12 −12 src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php
  168. +1 −1 src/Symfony/Component/Security/Http/Tests/Session/SessionAuthenticationStrategyTest.php
  169. +4 −4 src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php
  170. +4 −4 src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php
  171. +2 −2 src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php
  172. +4 −4 src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php
  173. +1 −1 src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
  174. +4 −4 src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php
  175. +1 −1 src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
  176. +4 −4 src/Symfony/Component/Serializer/Tests/SerializerTest.php
  177. +5 −5 src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
  178. +2 −2 src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
  179. +7 −7 src/Symfony/Component/Translation/Tests/MessageCatalogueTest.php
  180. +3 −3 src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php
  181. +3 −3 src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
  182. +2 −2 src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php
  183. +8 −8 src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
  184. +1 −1 src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php
  185. +3 −3 src/Symfony/Component/Validator/Tests/Mapping/Cache/AbstractCacheTest.php
  186. +3 −3 src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php
  187. +4 −4 src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php
  188. +2 −2 src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
  189. +4 −4 src/Symfony/Component/Workflow/Tests/RegistryTest.php
@@ -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(
@@ -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;
@@ -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;
}));
});
}
/**
@@ -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);
}
@@ -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(),
@@ -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;
}
@@ -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;
}
@@ -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);
@@ -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())
@@ -92,10 +92,10 @@ private function createRequestEvent($additionalServerParameters = []): array
->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];
}
@@ -62,15 +62,15 @@ 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')
->disableOriginalConstructor()
->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');
@@ -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();
@@ -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())
@@ -62,11 +62,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;
}
@@ -77,9 +77,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())

0 comments on commit 06c6552

Please sign in to comment.
You can’t perform that action at this time.