Skip to content
Snippets Groups Projects
Commit d671f38a authored by catch's avatar catch
Browse files

Issue #3433052 by mondrake: Fix remaining return*() methods of class...

Issue #3433052 by mondrake: Fix remaining return*() methods of class PHPUnit\Framework\TestCase deprecated in PHPUnit 10
parent 1f582eb2
No related branches found
No related tags found
No related merge requests found
...@@ -57,17 +57,17 @@ protected function setUp(): void { ...@@ -57,17 +57,17 @@ protected function setUp(): void {
$language_de = $this->createMock(LanguageInterface::class); $language_de = $this->createMock(LanguageInterface::class);
$language_de->expects($this->any()) $language_de->expects($this->any())
->method('getId') ->method('getId')
->will($this->returnValue('de')); ->willReturn('de');
$language_de->expects($this->any()) $language_de->expects($this->any())
->method('getName') ->method('getName')
->will($this->returnValue('German')); ->willReturn('German');
$language_en = $this->createMock(LanguageInterface::class); $language_en = $this->createMock(LanguageInterface::class);
$language_en->expects($this->any()) $language_en->expects($this->any())
->method('getId') ->method('getId')
->will($this->returnValue('en')); ->willReturn('en');
$language_en->expects($this->any()) $language_en->expects($this->any())
->method('getName') ->method('getName')
->will($this->returnValue('English')); ->willReturn('English');
$this->languages = [ $this->languages = [
'de' => $language_de, 'de' => $language_de,
'en' => $language_en, 'en' => $language_en,
...@@ -76,10 +76,10 @@ protected function setUp(): void { ...@@ -76,10 +76,10 @@ protected function setUp(): void {
$language_manager = $this->createMock(ConfigurableLanguageManagerInterface::class); $language_manager = $this->createMock(ConfigurableLanguageManagerInterface::class);
$language_manager->expects($this->any()) $language_manager->expects($this->any())
->method('getLanguages') ->method('getLanguages')
->will($this->returnValue($this->languages)); ->willReturn($this->languages);
$language_manager->expects($this->any()) $language_manager->expects($this->any())
->method('getNativeLanguages') ->method('getNativeLanguages')
->will($this->returnValue($this->languages)); ->willReturn($this->languages);
$this->languageManager = $language_manager; $this->languageManager = $language_manager;
$container = new ContainerBuilder(); $container = new ContainerBuilder();
...@@ -167,10 +167,10 @@ public function testProcessOutbound() { ...@@ -167,10 +167,10 @@ public function testProcessOutbound() {
['hasLowerLanguageNegotiationWeight', 'meetsContentEntityRoutesCondition', 'getLangcode']); ['hasLowerLanguageNegotiationWeight', 'meetsContentEntityRoutesCondition', 'getLangcode']);
$languageNegotiationContentEntityMock->expects($this->any()) $languageNegotiationContentEntityMock->expects($this->any())
->method('hasLowerLanguageNegotiationWeight') ->method('hasLowerLanguageNegotiationWeight')
->will($this->returnValue(TRUE)); ->willReturn(TRUE);
$languageNegotiationContentEntityMock->expects($this->any()) $languageNegotiationContentEntityMock->expects($this->any())
->method('meetsContentEntityRoutesCondition') ->method('meetsContentEntityRoutesCondition')
->will($this->returnValue(TRUE)); ->willReturn(TRUE);
$languageNegotiationContentEntityMock->expects($this->exactly(2)) $languageNegotiationContentEntityMock->expects($this->exactly(2))
->method('getLangcode') ->method('getLangcode')
->willReturnOnConsecutiveCalls( ->willReturnOnConsecutiveCalls(
......
...@@ -49,7 +49,7 @@ public function testFormatterLinkItemUrlMalformed() { ...@@ -49,7 +49,7 @@ public function testFormatterLinkItemUrlMalformed() {
$fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class); $fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class);
$fieldTypePluginManager->expects($this->once()) $fieldTypePluginManager->expects($this->once())
->method('createFieldItem') ->method('createFieldItem')
->will($this->returnValue($linkItem)); ->willReturn($linkItem);
$urlGenerator = $this->createMock(UrlGenerator::class); $urlGenerator = $this->createMock(UrlGenerator::class);
$urlGenerator->expects($this->once()) $urlGenerator->expects($this->once())
->method('generateFromRoute') ->method('generateFromRoute')
...@@ -91,7 +91,7 @@ public function testFormatterLinkItemUrlUnexpectedException() { ...@@ -91,7 +91,7 @@ public function testFormatterLinkItemUrlUnexpectedException() {
$fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class); $fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class);
$fieldTypePluginManager->expects($this->once()) $fieldTypePluginManager->expects($this->once())
->method('createFieldItem') ->method('createFieldItem')
->will($this->returnValue($linkItem)); ->willReturn($linkItem);
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$container->set('plugin.manager.field.field_type', $fieldTypePluginManager); $container->set('plugin.manager.field.field_type', $fieldTypePluginManager);
\Drupal::setContainer($container); \Drupal::setContainer($container);
...@@ -128,7 +128,7 @@ public function testFormatterLinkItem() { ...@@ -128,7 +128,7 @@ public function testFormatterLinkItem() {
$fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class); $fieldTypePluginManager = $this->createMock(FieldTypePluginManagerInterface::class);
$fieldTypePluginManager->expects($this->once()) $fieldTypePluginManager->expects($this->once())
->method('createFieldItem') ->method('createFieldItem')
->will($this->returnValue($linkItem)); ->willReturn($linkItem);
$urlGenerator = $this->createMock(UrlGenerator::class); $urlGenerator = $this->createMock(UrlGenerator::class);
$urlGenerator->expects($this->once()) $urlGenerator->expects($this->once())
->method('generateFromRoute') ->method('generateFromRoute')
......
...@@ -54,7 +54,7 @@ protected function setUp(): void { ...@@ -54,7 +54,7 @@ protected function setUp(): void {
->expects($this->once()) ->expects($this->once())
->method('hasLinkTemplate') ->method('hasLinkTemplate')
->with('version-history') ->with('version-history')
->will($this->returnValue(TRUE)); ->willReturn(TRUE);
$entityTypeManager = $this->createMock(EntityTypeManagerInterface::class); $entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
$entityTypeManager->expects($this->any()) $entityTypeManager->expects($this->any())
->method('getDefinitions') ->method('getDefinitions')
......
...@@ -114,10 +114,10 @@ public function testUpdateEmail($notification_threshold, $params, $authorized, a ...@@ -114,10 +114,10 @@ public function testUpdateEmail($notification_threshold, $params, $authorized, a
$this->configFactory $this->configFactory
->expects($this->exactly(2)) ->expects($this->exactly(2))
->method('get') ->method('get')
->will($this->returnValueMap([ ->willReturnMap([
['system.site', $config_site_name], ['system.site', $config_site_name],
['update.settings', $config_notification], ['update.settings', $config_notification],
])); ]);
// The calls to generateFromRoute differ if authorized. // The calls to generateFromRoute differ if authorized.
$count = 2; $count = 2;
...@@ -133,11 +133,11 @@ public function testUpdateEmail($notification_threshold, $params, $authorized, a ...@@ -133,11 +133,11 @@ public function testUpdateEmail($notification_threshold, $params, $authorized, a
$this->urlGenerator $this->urlGenerator
->expects($this->exactly($count)) ->expects($this->exactly($count))
->method('generateFromRoute') ->method('generateFromRoute')
->will($this->returnValueMap([ ->willReturnMap([
['update.status', [], ['absolute' => TRUE, 'language' => $langcode], FALSE, $update_settings_url], ['update.status', [], ['absolute' => TRUE, 'language' => $langcode], FALSE, $update_settings_url],
['update.settings', [], ['absolute' => TRUE], FALSE, $available_updates_url], ['update.settings', [], ['absolute' => TRUE], FALSE, $available_updates_url],
['update.report_update', [], ['absolute' => TRUE, 'language' => $langcode], FALSE, $available_updates_url], ['update.report_update', [], ['absolute' => TRUE, 'language' => $langcode], FALSE, $available_updates_url],
])); ]);
// Set the container. // Set the container.
$this->container->set('language_manager', $this->languageManager); $this->container->set('language_manager', $this->languageManager);
......
...@@ -74,7 +74,7 @@ public function testQuery() { ...@@ -74,7 +74,7 @@ public function testQuery() {
]); ]);
$this->view->expects($this->any()) $this->view->expects($this->any())
->method('getRequest') ->method('getRequest')
->will($this->returnValue($request)); ->willReturn($request);
$options = []; $options = [];
$this->pager->init($this->view, $this->display, $options); $this->pager->init($this->view, $this->display, $options);
......
...@@ -56,13 +56,13 @@ public function testDifferentServices() { ...@@ -56,13 +56,13 @@ public function testDifferentServices() {
$container->expects($this->exactly(2)) $container->expects($this->exactly(2))
->method('get') ->method('get')
->will( ->willReturnCallback(
$this->returnCallback(function ($service) use ($testFastCacheFactory, $testConsistentCacheFactory) { function ($service) use ($testFastCacheFactory, $testConsistentCacheFactory) {
return match ($service) { return match ($service) {
'cache.backend.test_consistent' => $testConsistentCacheFactory, 'cache.backend.test_consistent' => $testConsistentCacheFactory,
'cache.backend.test_fast' => $testFastCacheFactory, 'cache.backend.test_fast' => $testFastCacheFactory,
}; };
}) }
); );
// The same bin should be retrieved from both backends. // The same bin should be retrieved from both backends.
......
...@@ -51,10 +51,10 @@ protected function setUp(): void { ...@@ -51,10 +51,10 @@ protected function setUp(): void {
$this->sourceStorage->expects($this->atLeastOnce()) $this->sourceStorage->expects($this->atLeastOnce())
->method('getCollectionName') ->method('getCollectionName')
->will($this->returnValue(StorageInterface::DEFAULT_COLLECTION)); ->willReturn(StorageInterface::DEFAULT_COLLECTION);
$this->targetStorage->expects($this->atLeastOnce()) $this->targetStorage->expects($this->atLeastOnce())
->method('getCollectionName') ->method('getCollectionName')
->will($this->returnValue(StorageInterface::DEFAULT_COLLECTION)); ->willReturn(StorageInterface::DEFAULT_COLLECTION);
$this->storageComparer = new StorageComparer($this->sourceStorage, $this->targetStorage); $this->storageComparer = new StorageComparer($this->sourceStorage, $this->targetStorage);
} }
......
...@@ -36,10 +36,10 @@ protected function setUp(): void { ...@@ -36,10 +36,10 @@ protected function setUp(): void {
$language = new Language(['langcode' => 'en']); $language = new Language(['langcode' => 'en']);
$this->languageManager->expects($this->any()) $this->languageManager->expects($this->any())
->method('getDefaultLanguage') ->method('getDefaultLanguage')
->will($this->returnValue($language)); ->willReturn($language);
$this->languageManager->expects($this->any()) $this->languageManager->expects($this->any())
->method('getCurrentLanguage') ->method('getCurrentLanguage')
->will($this->returnValue($language)); ->willReturn($language);
$container->set('language_manager', $this->languageManager); $container->set('language_manager', $this->languageManager);
\Drupal::setContainer($container); \Drupal::setContainer($container);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment