diff --git a/core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php b/core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php index fac7885f7bf1470d8114873fac7be67a89237629..e62321169462de8d1dae9549462ef775ffd1af0f 100644 --- a/core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php +++ b/core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php @@ -57,17 +57,17 @@ protected function setUp(): void { $language_de = $this->createMock(LanguageInterface::class); $language_de->expects($this->any()) ->method('getId') - ->will($this->returnValue('de')); + ->willReturn('de'); $language_de->expects($this->any()) ->method('getName') - ->will($this->returnValue('German')); + ->willReturn('German'); $language_en = $this->createMock(LanguageInterface::class); $language_en->expects($this->any()) ->method('getId') - ->will($this->returnValue('en')); + ->willReturn('en'); $language_en->expects($this->any()) ->method('getName') - ->will($this->returnValue('English')); + ->willReturn('English'); $this->languages = [ 'de' => $language_de, 'en' => $language_en, @@ -76,10 +76,10 @@ protected function setUp(): void { $language_manager = $this->createMock(ConfigurableLanguageManagerInterface::class); $language_manager->expects($this->any()) ->method('getLanguages') - ->will($this->returnValue($this->languages)); + ->willReturn($this->languages); $language_manager->expects($this->any()) ->method('getNativeLanguages') - ->will($this->returnValue($this->languages)); + ->willReturn($this->languages); $this->languageManager = $language_manager; $container = new ContainerBuilder(); @@ -167,10 +167,10 @@ public function testProcessOutbound() { ['hasLowerLanguageNegotiationWeight', 'meetsContentEntityRoutesCondition', 'getLangcode']); $languageNegotiationContentEntityMock->expects($this->any()) ->method('hasLowerLanguageNegotiationWeight') - ->will($this->returnValue(TRUE)); + ->willReturn(TRUE); $languageNegotiationContentEntityMock->expects($this->any()) ->method('meetsContentEntityRoutesCondition') - ->will($this->returnValue(TRUE)); + ->willReturn(TRUE); $languageNegotiationContentEntityMock->expects($this->exactly(2)) ->method('getLangcode') ->willReturnOnConsecutiveCalls( diff --git a/core/modules/link/tests/src/Unit/LinkFormatterTest.php b/core/modules/link/tests/src/Unit/LinkFormatterTest.php index c86e1d9bf7a8884b874112233fff71ba0778b7af..c4867bff3a7822e7a4dff8da81fa05a4b9959f8b 100644 --- a/core/modules/link/tests/src/Unit/LinkFormatterTest.php +++ b/core/modules/link/tests/src/Unit/LinkFormatterTest.php @@ -49,7 +49,7 @@ public function testFormatterLinkItemUrlMalformed() { $fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class); $fieldTypePluginManager->expects($this->once()) ->method('createFieldItem') - ->will($this->returnValue($linkItem)); + ->willReturn($linkItem); $urlGenerator = $this->createMock(UrlGenerator::class); $urlGenerator->expects($this->once()) ->method('generateFromRoute') @@ -91,7 +91,7 @@ public function testFormatterLinkItemUrlUnexpectedException() { $fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class); $fieldTypePluginManager->expects($this->once()) ->method('createFieldItem') - ->will($this->returnValue($linkItem)); + ->willReturn($linkItem); $container = new ContainerBuilder(); $container->set('plugin.manager.field.field_type', $fieldTypePluginManager); \Drupal::setContainer($container); @@ -128,7 +128,7 @@ public function testFormatterLinkItem() { $fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class); $fieldTypePluginManager->expects($this->once()) ->method('createFieldItem') - ->will($this->returnValue($linkItem)); + ->willReturn($linkItem); $urlGenerator = $this->createMock(UrlGenerator::class); $urlGenerator->expects($this->once()) ->method('generateFromRoute') diff --git a/core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php b/core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php index 11564a2aca3269e27bdc7f5fae40a3753581c986..735d3513210a614870dd43291ae869a64ed5367c 100644 --- a/core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php +++ b/core/modules/system/tests/src/Unit/Menu/SystemLocalTasksTest.php @@ -54,7 +54,7 @@ protected function setUp(): void { ->expects($this->once()) ->method('hasLinkTemplate') ->with('version-history') - ->will($this->returnValue(TRUE)); + ->willReturn(TRUE); $entityTypeManager = $this->createMock(EntityTypeManagerInterface::class); $entityTypeManager->expects($this->any()) ->method('getDefinitions') diff --git a/core/modules/update/tests/src/Unit/UpdateMailTest.php b/core/modules/update/tests/src/Unit/UpdateMailTest.php index b79df48c95008d928ebeb84fcc2af8b433839796..5e46b751b20fefddd2d0aaa9289c0c651a1cee20 100644 --- a/core/modules/update/tests/src/Unit/UpdateMailTest.php +++ b/core/modules/update/tests/src/Unit/UpdateMailTest.php @@ -114,10 +114,10 @@ public function testUpdateEmail($notification_threshold, $params, $authorized, a $this->configFactory ->expects($this->exactly(2)) ->method('get') - ->will($this->returnValueMap([ + ->willReturnMap([ ['system.site', $config_site_name], ['update.settings', $config_notification], - ])); + ]); // The calls to generateFromRoute differ if authorized. $count = 2; @@ -133,11 +133,11 @@ public function testUpdateEmail($notification_threshold, $params, $authorized, a $this->urlGenerator ->expects($this->exactly($count)) ->method('generateFromRoute') - ->will($this->returnValueMap([ + ->willReturnMap([ ['update.status', [], ['absolute' => TRUE, 'language' => $langcode], FALSE, $update_settings_url], ['update.settings', [], ['absolute' => TRUE], FALSE, $available_updates_url], ['update.report_update', [], ['absolute' => TRUE, 'language' => $langcode], FALSE, $available_updates_url], - ])); + ]); // Set the container. $this->container->set('language_manager', $this->languageManager); diff --git a/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php index a51f267792f65ab949331cecf7c66ffb7c4e350d..a56d8e409d106ab3295253cfa08a56a2e9c1cbfc 100644 --- a/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php @@ -74,7 +74,7 @@ public function testQuery() { ]); $this->view->expects($this->any()) ->method('getRequest') - ->will($this->returnValue($request)); + ->willReturn($request); $options = []; $this->pager->init($this->view, $this->display, $options); diff --git a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php index 6b14a97c3a82b8873caf1af2315e16445b2f6ae7..436db6dc00c09feee721f28236b3223641daaaf2 100644 --- a/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendFactoryTest.php @@ -56,13 +56,13 @@ public function testDifferentServices() { $container->expects($this->exactly(2)) ->method('get') - ->will( - $this->returnCallback(function ($service) use ($testFastCacheFactory, $testConsistentCacheFactory) { + ->willReturnCallback( + function ($service) use ($testFastCacheFactory, $testConsistentCacheFactory) { return match ($service) { 'cache.backend.test_consistent' => $testConsistentCacheFactory, 'cache.backend.test_fast' => $testFastCacheFactory, }; - }) + } ); // The same bin should be retrieved from both backends. diff --git a/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php b/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php index aaf6d9dc27c4343b2cc1c46be7da12c4e49c22a4..a3c7e63fea22d3c36fcf434113191d5bee058582 100644 --- a/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php +++ b/core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php @@ -51,10 +51,10 @@ protected function setUp(): void { $this->sourceStorage->expects($this->atLeastOnce()) ->method('getCollectionName') - ->will($this->returnValue(StorageInterface::DEFAULT_COLLECTION)); + ->willReturn(StorageInterface::DEFAULT_COLLECTION); $this->targetStorage->expects($this->atLeastOnce()) ->method('getCollectionName') - ->will($this->returnValue(StorageInterface::DEFAULT_COLLECTION)); + ->willReturn(StorageInterface::DEFAULT_COLLECTION); $this->storageComparer = new StorageComparer($this->sourceStorage, $this->targetStorage); } diff --git a/core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php b/core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php index 41ca72ba1ff709d29545eef569f618e49f161b8e..40111e41eec7375f32b72afa6479d54a6581e737 100644 --- a/core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php +++ b/core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php @@ -36,10 +36,10 @@ protected function setUp(): void { $language = new Language(['langcode' => 'en']); $this->languageManager->expects($this->any()) ->method('getDefaultLanguage') - ->will($this->returnValue($language)); + ->willReturn($language); $this->languageManager->expects($this->any()) ->method('getCurrentLanguage') - ->will($this->returnValue($language)); + ->willReturn($language); $container->set('language_manager', $this->languageManager); \Drupal::setContainer($container);