From 503192fcfe01de53febcb416e6c5a467ed01ebf9 Mon Sep 17 00:00:00 2001 From: quietone <quietone@2572884.no-reply.drupal.org> Date: Tue, 30 Jan 2024 12:42:46 +1300 Subject: [PATCH] Issue #3412464 by mstrelan, smustgrave: Fix strict type errors: Convert FormattableMarkup to strings (complex replacement) in core Functional tests --- .../Functional/Views/BlockContentTestBase.php | 5 ++-- .../src/Functional/CommentLanguageTest.php | 4 +-- .../tests/src/Functional/CommentPagerTest.php | 2 +- .../Views/DefaultViewRecentCommentsTest.php | 5 +--- .../src/Functional/ContactSitewideTest.php | 3 +-- .../ContentTranslationSettingsTest.php | 5 ++-- .../dblog/tests/src/Functional/DbLogTest.php | 2 +- .../EntityReferenceIntegrationTest.php | 5 ++-- .../src/Functional/TranslationWebTest.php | 3 +-- .../src/Functional/FileFieldPathTest.php | 7 +++--- .../src/Functional/FileFieldValidateTest.php | 12 +++------ .../src/Functional/FileFieldWidgetTest.php | 3 +-- .../src/Functional/FileManagedTestBase.php | 6 ++--- .../src/Functional/ImageAdminStylesTest.php | 25 ++++++------------- .../ImageFieldDefaultImagesTest.php | 17 ++++++------- .../src/Functional/ImageStyleFlushTest.php | 9 +++---- .../Database/SelectTableSortDefaultTest.php | 6 ++--- .../tests/src/Functional/Form/FormTest.php | 12 +++------ .../Functional/Menu/AssertBreadcrumbTrait.php | 11 ++++---- .../src/Functional/Module/ModuleTestBase.php | 7 +++--- .../tests/src/Functional/BulkFormTest.php | 3 +-- .../src/Functional/Plugin/FilterTest.php | 7 +++--- .../tests/src/Functional/Wizard/MenuTest.php | 3 +-- .../src/Functional/CustomBooleanTest.php | 9 +++---- .../src/Functional/DemoUmamiProfileTest.php | 3 +-- 25 files changed, 65 insertions(+), 109 deletions(-) diff --git a/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php b/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php index 3482f7923c9a..13b17ff4ef4c 100644 --- a/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php +++ b/core/modules/block_content/tests/src/Functional/Views/BlockContentTestBase.php @@ -4,7 +4,6 @@ use Drupal\block_content\Entity\BlockContent; use Drupal\block_content\Entity\BlockContentType; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\views\Functional\ViewTestBase; /** @@ -71,7 +70,7 @@ protected function createBlockContent(array $values = []) { if ($block_content = BlockContent::create($values)) { $status = $block_content->save(); } - $this->assertEquals(SAVED_NEW, $status, new FormattableMarkup('Created block content %info.', ['%info' => $block_content->label()])); + $this->assertEquals(SAVED_NEW, $status, "Created block content {$block_content->label()}."); return $block_content; } @@ -103,7 +102,7 @@ protected function createBlockContentType(array $values = []) { $status = $bundle->save(); block_content_add_body_field($bundle->id()); - $this->assertEquals(SAVED_NEW, $status, new FormattableMarkup('Created block content type %bundle.', ['%bundle' => $bundle->id()])); + $this->assertEquals(SAVED_NEW, $status, sprintf('Created block content type %s.', $bundle->id())); return $bundle; } diff --git a/core/modules/comment/tests/src/Functional/CommentLanguageTest.php b/core/modules/comment/tests/src/Functional/CommentLanguageTest.php index 6478000e19f1..87d637e77071 100644 --- a/core/modules/comment/tests/src/Functional/CommentLanguageTest.php +++ b/core/modules/comment/tests/src/Functional/CommentLanguageTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\comment\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\comment\Entity\Comment; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\comment\Tests\CommentTestTrait; @@ -149,8 +148,7 @@ public function testCommentLanguage() { ->range(0, 1) ->execute(); $comment = Comment::load(reset($cids)); - $args = ['%node_language' => $node_langcode, '%comment_language' => $comment->langcode->value, '%langcode' => $langcode]; - $this->assertEquals($langcode, $comment->langcode->value, new FormattableMarkup('The comment posted with content language %langcode and belonging to the node with language %node_language has language %comment_language', $args)); + $this->assertEquals($langcode, $comment->langcode->value, "The comment posted with content language $langcode and belonging to the node with language $node_langcode has language {$comment->langcode->value}"); $this->assertEquals($comment_values[$node_langcode][$langcode], $comment->comment_body->value, 'Comment body correctly stored.'); } } diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index 7cfc883fba7f..75521d6cb77a 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -238,7 +238,7 @@ public function assertCommentOrder(array $comments, array $expected_order): void foreach ($comment_anchors as $anchor) { $result_order[] = substr($anchor->getAttribute('id'), 8); } - $this->assertEquals($expected_cids, $result_order, new FormattableMarkup('Comment order: expected @expected, returned @returned.', ['@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order)])); + $this->assertEquals($expected_cids, $result_order, sprintf('Comment order: expected %s, returned %s.', implode(',', $expected_cids), implode(',', $result_order))); } /** diff --git a/core/modules/comment/tests/src/Functional/Views/DefaultViewRecentCommentsTest.php b/core/modules/comment/tests/src/Functional/Views/DefaultViewRecentCommentsTest.php index 5e584b15fd43..cd9145427a4d 100644 --- a/core/modules/comment/tests/src/Functional/Views/DefaultViewRecentCommentsTest.php +++ b/core/modules/comment/tests/src/Functional/Views/DefaultViewRecentCommentsTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\comment\Functional\Views; -use Drupal\Component\Render\FormattableMarkup; use Drupal\comment\CommentInterface; use Drupal\comment\Entity\Comment; use Drupal\comment\Tests\CommentTestTrait; @@ -140,9 +139,7 @@ public function testBlockDisplay() { // Check the number of results given by the display is the expected. $this->assertCount($this->blockDisplayResults, $view->result, - new FormattableMarkup('There are exactly @results comments. Expected @expected', - ['@results' => count($view->result), '@expected' => $this->blockDisplayResults] - ) + 'There are exactly ' . count($view->result) . ' comments. Expected ' . $this->blockDisplayResults ); } diff --git a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php index 16592853717a..45cffdc9d2ec 100644 --- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php +++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\contact\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Url; use Drupal\contact\Entity\ContactForm; use Drupal\Core\Mail\MailFormatHelper; @@ -612,7 +611,7 @@ public function deleteContactForms() { $this->drupalGet("admin/structure/contact/manage/{$id}/delete"); $this->submitForm([], 'Delete'); $this->assertSession()->pageTextContains("The contact form {$contact_form->label()} has been deleted."); - $this->assertNull(ContactForm::load($id), new FormattableMarkup('Form %contact_form not found', ['%contact_form' => $contact_form->label()])); + $this->assertNull(ContactForm::load($id), "Form {$contact_form->label()} not found"); } } } diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php index a2d9b85d9ea3..6adb974f77a0 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\content_translation\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\comment\Tests\CommentTestTrait; use Drupal\Core\Field\Entity\BaseFieldOverride; @@ -282,8 +281,8 @@ public function testAccountLanguageSettingsUI() { protected function assertSettings(string $entity_type, ?string $bundle, bool $enabled, array $edit): void { $this->drupalGet('admin/config/regional/content-language'); $this->submitForm($edit, 'Save configuration'); - $args = ['@entity_type' => $entity_type, '@bundle' => $bundle, '@enabled' => $enabled ? 'enabled' : 'disabled']; - $message = new FormattableMarkup('Translation for entity @entity_type (@bundle) is @enabled.', $args); + $status = $enabled ? 'enabled' : 'disabled'; + $message = "Translation for entity $entity_type ($bundle) is $status."; $this->assertEquals($enabled, \Drupal::service('content_translation.manager')->isEnabled($entity_type, $bundle), $message); } diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php index b43086ae19bd..82fa30d34fc0 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -487,7 +487,7 @@ private function doUser() { $ids[] = $row->wid; } $count_before = (isset($ids)) ? count($ids) : 0; - $this->assertGreaterThan(0, $count_before, new FormattableMarkup('DBLog contains @count records for @name', ['@count' => $count_before, '@name' => $user->getAccountName()])); + $this->assertGreaterThan(0, $count_before, "DBLog contains $count_before records for {$user->getAccountName()}"); // Log in the admin user. $this->drupalLogin($this->adminUser); diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php index 415ac1bdb525..5d23896ac0e2 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\field\Functional\EntityReference; -use Drupal\Component\Render\FormattableMarkup; use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\Tests\BrowserTestBase; @@ -172,7 +171,7 @@ public function testSupportedEntityTypesAndWidgets() { // Ensure the configuration has the expected dependency on the entity that // is being used a default value. $field = FieldConfig::loadByName($this->entityType, $this->bundle, $this->fieldName); - $this->assertContains($referenced_entities[0]->getConfigDependencyName(), $field->getDependencies()[$key], new FormattableMarkup('Expected @type dependency @name found', ['@type' => $key, '@name' => $referenced_entities[0]->getConfigDependencyName()])); + $this->assertContains($referenced_entities[0]->getConfigDependencyName(), $field->getDependencies()[$key], 'Expected ' . $key . ' dependency ' . $referenced_entities[0]->getConfigDependencyName() . ' found'); // Ensure that the field can be imported without change even after the // default value deleted. $referenced_entities[0]->delete(); @@ -186,7 +185,7 @@ public function testSupportedEntityTypesAndWidgets() { $field = FieldConfig::loadByName($this->entityType, $this->bundle, $this->fieldName); $field->save(); $dependencies = $field->getDependencies(); - $this->assertFalse(isset($dependencies[$key]) && in_array($referenced_entities[0]->getConfigDependencyName(), $dependencies[$key]), new FormattableMarkup('@type dependency @name does not exist.', ['@type' => $key, '@name' => $referenced_entities[0]->getConfigDependencyName()])); + $this->assertFalse(isset($dependencies[$key]) && in_array($referenced_entities[0]->getConfigDependencyName(), $dependencies[$key]), $key . ' dependency ' . $referenced_entities[0]->getConfigDependencyName() . ' does not exist.'); } } diff --git a/core/modules/field/tests/src/Functional/TranslationWebTest.php b/core/modules/field/tests/src/Functional/TranslationWebTest.php index 30f01f4b8c1f..71a5cee4fb49 100644 --- a/core/modules/field/tests/src/Functional/TranslationWebTest.php +++ b/core/modules/field/tests/src/Functional/TranslationWebTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\field\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldConfig; use Drupal\language\Entity\ConfigurableLanguage; @@ -145,7 +144,7 @@ private function checkTranslationRevisions($id, $revision_id, $available_langcod $entity = $storage->loadRevision($revision_id); foreach ($available_langcodes as $langcode => $value) { $passed = $entity->getTranslation($langcode)->{$field_name}->value == $value + 1; - $this->assertTrue($passed, new FormattableMarkup('The @language translation for revision @revision was correctly stored', ['@language' => $langcode, '@revision' => $entity->getRevisionId()])); + $this->assertTrue($passed, "The $langcode translation for revision {$entity->getRevisionId()} was correctly stored"); } } diff --git a/core/modules/file/tests/src/Functional/FileFieldPathTest.php b/core/modules/file/tests/src/Functional/FileFieldPathTest.php index 084e492b2dfa..d706a38401a9 100644 --- a/core/modules/file/tests/src/Functional/FileFieldPathTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldPathTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\file\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\file\Entity\File; /** @@ -43,7 +42,7 @@ public function testUploadPath() { $date_formatter->format(REQUEST_TIME, 'custom', 'Y') . '-' . $date_formatter->format(REQUEST_TIME, 'custom', 'm') . '/' . $test_file->getFilename(); - $this->assertPathMatch($expected_filename, $node_file->getFileUri(), new FormattableMarkup('The file %file was uploaded to the correct path.', ['%file' => $node_file->getFileUri()])); + $this->assertPathMatch($expected_filename, $node_file->getFileUri(), "The file {$node_file->getFileUri()} was uploaded to the correct path."); // Change the path to contain multiple subdirectories. $this->updateFileField($field_name, $type_name, ['file_directory' => 'foo/bar/baz']); @@ -55,7 +54,7 @@ public function testUploadPath() { $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $node_file = File::load($node->{$field_name}->target_id); - $this->assertPathMatch('public://foo/bar/baz/' . $test_file->getFilename(), $node_file->getFileUri(), new FormattableMarkup('The file %file was uploaded to the correct path.', ['%file' => $node_file->getFileUri()])); + $this->assertPathMatch('public://foo/bar/baz/' . $test_file->getFilename(), $node_file->getFileUri(), "The file {$node_file->getFileUri()} was uploaded to the correct path."); // Check the path when used with tokens. // Change the path to contain multiple token directories. @@ -72,7 +71,7 @@ public function testUploadPath() { // the user running the test case. $data = ['user' => $this->adminUser]; $subdirectory = \Drupal::token()->replace('[user:uid]/[user:name]', $data); - $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->getFilename(), $node_file->getFileUri(), new FormattableMarkup('The file %file was uploaded to the correct path with token replacements.', ['%file' => $node_file->getFileUri()])); + $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->getFilename(), $node_file->getFileUri(), "The file {$node_file->getFileUri()} was uploaded to the correct path with token replacements."); } /** diff --git a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php index 18967d329529..27619cc93aa9 100644 --- a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\file\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\StringTranslation\ByteSizeMarkup; use Drupal\field\Entity\FieldConfig; @@ -44,7 +43,7 @@ public function testRequired() { // Create a new node with the uploaded file. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); - $this->assertNotFalse($nid, new FormattableMarkup('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', ['@test_file' => $test_file->getFileUri(), '@field_name' => $field_name, '@type_name' => $type_name])); + $this->assertNotFalse($nid, "uploadNodeFile({$test_file->getFileUri()}, $field_name, $type_name) succeeded"); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); @@ -104,10 +103,7 @@ public function testFileMaxSize() { $node = $node_storage->load($nid); $node_file = File::load($node->{$field_name}->target_id); $this->assertFileExists($node_file->getFileUri()); - $this->assertFileEntryExists($node_file, new FormattableMarkup('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', [ - '%filesize' => ByteSizeMarkup::create($small_file->getSize()), - '%maxsize' => $max_filesize, - ])); + $this->assertFileEntryExists($node_file, sprintf('File entry exists after uploading a file (%s) under the max limit (%s).', ByteSizeMarkup::create($small_file->getSize()), $max_filesize)); // Check that uploading the large file fails (1M limit). $this->uploadNodeFile($large_file, $field_name, $type_name); @@ -125,9 +121,7 @@ public function testFileMaxSize() { $node = $node_storage->load($nid); $node_file = File::load($node->{$field_name}->target_id); $this->assertFileExists($node_file->getFileUri()); - $this->assertFileEntryExists($node_file, new FormattableMarkup('File entry exists after uploading a file (%filesize) with no max limit.', [ - '%filesize' => ByteSizeMarkup::create($large_file->getSize()), - ])); + $this->assertFileEntryExists($node_file, sprintf('File entry exists after uploading a file (%s) with no max limit.', ByteSizeMarkup::create($large_file->getSize()))); } /** diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php index 12e5f2e76fb5..4131560ee469 100644 --- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\file\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\comment\Entity\Comment; use Drupal\comment\Tests\CommentTestTrait; use Drupal\Component\Serialization\Json; @@ -168,7 +167,7 @@ public function testMultiValuedWidget() { // Ensure we have the expected number of Remove buttons, and that they // are numbered sequentially. $buttons = $this->xpath('//input[@type="submit" and @value="Remove"]'); - $this->assertCount($num_expected_remove_buttons, $buttons, new FormattableMarkup('There are %n "Remove" buttons displayed.', ['%n' => $num_expected_remove_buttons])); + $this->assertCount($num_expected_remove_buttons, $buttons, "There are $num_expected_remove_buttons \"Remove\" buttons displayed."); foreach ($buttons as $i => $button) { $key = $i >= $remaining ? $i - $remaining : $i; $check_field_name = $field_name2; diff --git a/core/modules/file/tests/src/Functional/FileManagedTestBase.php b/core/modules/file/tests/src/Functional/FileManagedTestBase.php index bb91f2c4b483..aa34b2982761 100644 --- a/core/modules/file/tests/src/Functional/FileManagedTestBase.php +++ b/core/modules/file/tests/src/Functional/FileManagedTestBase.php @@ -44,16 +44,16 @@ public function assertFileHooksCalled($expected) { // Determine if there were any expected that were not called. $uncalled = array_diff($expected, $actual); if (count($uncalled)) { - $this->assertTrue(FALSE, new FormattableMarkup('Expected hooks %expected to be called but %uncalled was not called.', ['%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled)])); + $this->assertTrue(FALSE, sprintf('Expected hooks %s to be called but %s was not called.', implode(', ', $expected), implode(', ', $uncalled))); } else { - $this->assertTrue(TRUE, new FormattableMarkup('All the expected hooks were called: %expected', ['%expected' => empty($expected) ? '(none)' : implode(', ', $expected)])); + $this->assertTrue(TRUE, sprintf('All the expected hooks were called: %s', empty($expected) ? '(none)' : implode(', ', $expected))); } // Determine if there were any unexpected calls. $unexpected = array_diff($actual, $expected); if (count($unexpected)) { - $this->assertTrue(FALSE, new FormattableMarkup('Unexpected hooks were called: %unexpected.', ['%unexpected' => empty($unexpected) ? '(none)' : implode(', ', $unexpected)])); + $this->assertTrue(FALSE, sprintf('Unexpected hooks were called: %s.', empty($unexpected) ? '(none)' : implode(', ', $unexpected))); } else { $this->assertTrue(TRUE, 'No unexpected hooks were called.'); diff --git a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php index e0c9e671f51c..b603c9502177 100644 --- a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php +++ b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\image\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Url; use Drupal\file\Entity\File; @@ -167,18 +166,13 @@ public function testStyle() { $uuids[$effect->getPluginId()] = $uuid; $effect_configuration = $effect->getConfiguration(); foreach ($effect_edits[$effect->getPluginId()] as $field => $value) { - $this->assertEquals($effect_configuration['data'][$field], $value, new FormattableMarkup('The %field field in the %effect effect has the correct value of %value.', ['%field' => $field, '%effect' => $effect->getPluginId(), '%value' => $value])); + $this->assertEquals($effect_configuration['data'][$field], $value, "The $field field in the {$effect->getPluginId()} effect has the correct value of $value."); } } // Assert that every effect was saved. foreach (array_keys($effect_edits) as $effect_name) { - $this->assertTrue(isset($uuids[$effect_name]), new FormattableMarkup( - 'A %effect_name effect was saved with ID %uuid', - [ - '%effect_name' => $effect_name, - '%uuid' => $uuids[$effect_name], - ])); + $this->assertTrue(isset($uuids[$effect_name]), "A $effect_name effect was saved with ID $uuids[$effect_name]"); } // Image style overview form (ordering and renaming). @@ -212,7 +206,7 @@ public function testStyle() { // Create an image to make sure it gets flushed after saving. $image_path = $this->createSampleImage($style); - $this->assertEquals(1, $this->getImageCount($style), new FormattableMarkup('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); + $this->assertEquals(1, $this->getImageCount($style), "Image style {$style->label()} image $image_path successfully generated."); $this->drupalGet($style_path); $this->submitForm($edit, 'Save'); @@ -231,7 +225,7 @@ public function testStyle() { // Check that the image was flushed after updating the style. // This is especially important when renaming the style. Make sure that // the old image directory has been deleted. - $this->assertEquals(0, $this->getImageCount($style), new FormattableMarkup('Image style %style was flushed after renaming the style and updating the order of effects.', ['%style' => $style->label()])); + $this->assertEquals(0, $this->getImageCount($style), "Image style {$style->label()} was flushed after renaming the style and updating the order of effects."); // Load the style by the new name with the new weights. $style = ImageStyle::load($style_name); @@ -252,7 +246,7 @@ public function testStyle() { // Create an image to make sure it gets flushed after deleting an effect. $image_path = $this->createSampleImage($style); - $this->assertEquals(1, $this->getImageCount($style), new FormattableMarkup('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); + $this->assertEquals(1, $this->getImageCount($style), "Image style {$style->label()} image $image_path successfully generated."); // Delete the 'image_crop' effect from the style. $this->drupalGet($style_path . '/effects/' . $uuids['image_crop'] . '/delete'); @@ -267,12 +261,7 @@ public function testStyle() { // actually deleted. $entity_type_manager = $this->container->get('entity_type.manager'); $style = $entity_type_manager->getStorage('image_style')->loadUnchanged($style->id()); - $this->assertFalse($style->getEffects()->has($uuids['image_crop']), new FormattableMarkup( - 'Effect with ID %uuid no longer found on image style %style', - [ - '%uuid' => $uuids['image_crop'], - '%style' => $style->label(), - ])); + $this->assertFalse($style->getEffects()->has($uuids['image_crop']), "Effect with ID {$uuids['image_crop']} no longer found on image style {$style->label()}"); // Additional test on Rotate effect, for transparent background. $edit = [ @@ -297,7 +286,7 @@ public function testStyle() { $directory = 'public://styles/' . $style_name; $this->assertDirectoryDoesNotExist($directory); - $this->assertNull(ImageStyle::load($style_name), new FormattableMarkup('Image style %style successfully deleted.', ['%style' => $style->label()])); + $this->assertNull(ImageStyle::load($style_name), "Image style {$style->label()} successfully deleted."); // Test empty text when there are no image styles. diff --git a/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php b/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php index b3b1dd9d248b..372b99835210 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDefaultImagesTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\image\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\File\FileSystemInterface; use Drupal\field\Entity\FieldConfig; @@ -145,7 +144,7 @@ public function testDefaultImages() { // Confirm that the image default is shown for a new article node. $article = $this->drupalCreateNode(['type' => 'article']); $article_built = $this->drupalBuildEntityView($article); - $this->assertEquals($default_images['field']->id(), $article_built[$field_name][0]['#item']->target_id, new FormattableMarkup('A new article node without an image has the expected default image file ID of @fid.', ['@fid' => $default_images['field']->id()])); + $this->assertEquals($default_images['field']->id(), $article_built[$field_name][0]['#item']->target_id, "A new article node without an image has the expected default image file ID of {$default_images['field']->id()}."); // Also check that the field renders without warnings when the label is // hidden. @@ -157,7 +156,7 @@ public function testDefaultImages() { // Confirm that the image default is shown for a new page node. $page = $this->drupalCreateNode(['type' => 'page']); $page_built = $this->drupalBuildEntityView($page); - $this->assertEquals($default_images['field2']->id(), $page_built[$field_name][0]['#item']->target_id, new FormattableMarkup('A new page node without an image has the expected default image file ID of @fid.', ['@fid' => $default_images['field2']->id()])); + $this->assertEquals($default_images['field2']->id(), $page_built[$field_name][0]['#item']->target_id, "A new page node without an image has the expected default image file ID of {$default_images['field2']->id()}."); // Upload a new default for the field storage. $default_image_settings = $field_storage->getSetting('default_image'); @@ -174,8 +173,8 @@ public function testDefaultImages() { $node_storage->resetCache([$article->id(), $page->id()]); $article_built = $this->drupalBuildEntityView($article = $node_storage->load($article->id())); $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); - $this->assertEquals($default_images['field']->id(), $article_built[$field_name][0]['#item']->target_id, new FormattableMarkup('An existing article node without an image has the expected default image file ID of @fid.', ['@fid' => $default_images['field']->id()])); - $this->assertEquals($default_images['field2']->id(), $page_built[$field_name][0]['#item']->target_id, new FormattableMarkup('An existing page node without an image has the expected default image file ID of @fid.', ['@fid' => $default_images['field2']->id()])); + $this->assertEquals($default_images['field']->id(), $article_built[$field_name][0]['#item']->target_id, "An existing article node without an image has the expected default image file ID of {$default_images['field']->id()}."); + $this->assertEquals($default_images['field2']->id(), $page_built[$field_name][0]['#item']->target_id, "An existing page node without an image has the expected default image file ID of {$default_images['field2']->id()}."); // Upload a new default for the article's field. $default_image_settings = $field->getSetting('default_image'); @@ -193,9 +192,9 @@ public function testDefaultImages() { $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); // Confirm the article uses the new default. - $this->assertEquals($default_images['field_new']->id(), $article_built[$field_name][0]['#item']->target_id, new FormattableMarkup('An existing article node without an image has the expected default image file ID of @fid.', ['@fid' => $default_images['field_new']->id()])); + $this->assertEquals($default_images['field_new']->id(), $article_built[$field_name][0]['#item']->target_id, "An existing article node without an image has the expected default image file ID of {$default_images['field_new']->id()}."); // Confirm the page remains unchanged. - $this->assertEquals($default_images['field2']->id(), $page_built[$field_name][0]['#item']->target_id, new FormattableMarkup('An existing page node without an image has the expected default image file ID of @fid.', ['@fid' => $default_images['field2']->id()])); + $this->assertEquals($default_images['field2']->id(), $page_built[$field_name][0]['#item']->target_id, "An existing page node without an image has the expected default image file ID of {$default_images['field2']->id()}."); // Confirm the default image is shown on the node form. $file = File::load($default_images['field_new']->id()); @@ -217,9 +216,9 @@ public function testDefaultImages() { $article_built = $this->drupalBuildEntityView($article = $node_storage->load($article->id())); $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); // Confirm the article uses the new field storage (not field) default. - $this->assertEquals($default_images['field_storage_new']->id(), $article_built[$field_name][0]['#item']->target_id, new FormattableMarkup('An existing article node without an image has the expected default image file ID of @fid.', ['@fid' => $default_images['field_storage_new']->id()])); + $this->assertEquals($default_images['field_storage_new']->id(), $article_built[$field_name][0]['#item']->target_id, "An existing article node without an image has the expected default image file ID of {$default_images['field_storage_new']->id()}."); // Confirm the page remains unchanged. - $this->assertEquals($default_images['field2']->id(), $page_built[$field_name][0]['#item']->target_id, new FormattableMarkup('An existing page node without an image has the expected default image file ID of @fid.', ['@fid' => $default_images['field2']->id()])); + $this->assertEquals($default_images['field2']->id(), $page_built[$field_name][0]['#item']->target_id, "An existing page node without an image has the expected default image file ID of {$default_images['field2']->id()}."); $non_image = $this->drupalGetTestFiles('text'); $this->submitForm(['files[settings_default_image_uuid]' => \Drupal::service('file_system')->realpath($non_image[0]->uri)], 'Upload'); diff --git a/core/modules/image/tests/src/Functional/ImageStyleFlushTest.php b/core/modules/image/tests/src/Functional/ImageStyleFlushTest.php index 133342919537..4a5d0bdb406a 100644 --- a/core/modules/image/tests/src/Functional/ImageStyleFlushTest.php +++ b/core/modules/image/tests/src/Functional/ImageStyleFlushTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\image\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\image\Entity\ImageStyle; use Drupal\Tests\TestFileCreationTrait; @@ -100,11 +99,11 @@ public function testFlush() { $image_path = $this->createSampleImage($style, 'public'); // Expecting to find 2 images, one is the sample.png image shown in // image style preview. - $this->assertEquals(2, $this->getImageCount($style, 'public'), new FormattableMarkup('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); + $this->assertEquals(2, $this->getImageCount($style, 'public'), "Image style {$style->label()} image $image_path successfully generated."); // Create an image for the 'private' wrapper. $image_path = $this->createSampleImage($style, 'private'); - $this->assertEquals(1, $this->getImageCount($style, 'private'), new FormattableMarkup('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path])); + $this->assertEquals(1, $this->getImageCount($style, 'private'), "Image style {$style->label()} image $image_path successfully generated."); // Remove the 'image_scale' effect and updates the style, which in turn // forces an image style flush. @@ -121,10 +120,10 @@ public function testFlush() { $this->assertSession()->statusCodeEquals(200); // Post flush, expected 1 image in the 'public' wrapper (sample.png). - $this->assertEquals(1, $this->getImageCount($style, 'public'), new FormattableMarkup('Image style %style flushed correctly for %wrapper wrapper.', ['%style' => $style->label(), '%wrapper' => 'public'])); + $this->assertEquals(1, $this->getImageCount($style, 'public'), "Image style {$style->label()} flushed correctly for public wrapper."); // Post flush, expected no image in the 'private' wrapper. - $this->assertEquals(0, $this->getImageCount($style, 'private'), new FormattableMarkup('Image style %style flushed correctly for %wrapper wrapper.', ['%style' => $style->label(), '%wrapper' => 'private'])); + $this->assertEquals(0, $this->getImageCount($style, 'private'), "Image style {$style->label()} flushed correctly for private wrapper."); $state = \Drupal::state(); $state->set('image_module_test_image_style_flush.called', FALSE); diff --git a/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php b/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php index 6d20a2e4cb12..9916295b4ba4 100644 --- a/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php +++ b/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php @@ -2,8 +2,6 @@ namespace Drupal\Tests\system\Functional\Database; -use Drupal\Component\Render\FormattableMarkup; - /** * Tests the tablesort query extender. * @@ -67,8 +65,8 @@ public function testTableSortQueryFirst() { $first = array_shift($data->tasks); $last = array_pop($data->tasks); - $this->assertEquals($sort['first'], $first->task, new FormattableMarkup('Items appear in the correct order sorting by @field @sort.', ['@field' => $sort['field'], '@sort' => $sort['sort']])); - $this->assertEquals($sort['last'], $last->task, new FormattableMarkup('Items appear in the correct order sorting by @field @sort.', ['@field' => $sort['field'], '@sort' => $sort['sort']])); + $this->assertEquals($sort['first'], $first->task, "Items appear in the correct order sorting by {$sort['field']} {$sort['sort']}."); + $this->assertEquals($sort['last'], $last->task, "Items appear in the correct order sorting by {$sort['field']} {$sort['sort']}."); } } diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php index 516829ffe673..864d07f00c19 100644 --- a/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -398,11 +398,7 @@ public function testCheckboxProcessing() { 'zero_checkbox_off' => 0, ]; foreach ($expected_values as $widget => $expected_value) { - $this->assertSame($values[$widget], $expected_value, new FormattableMarkup('Checkbox %widget returns expected value (expected: %expected, got: %value)', [ - '%widget' => var_export($widget, TRUE), - '%expected' => var_export($expected_value, TRUE), - '%value' => var_export($values[$widget], TRUE), - ])); + $this->assertSame($values[$widget], $expected_value, sprintf('Checkbox %s returns expected value (expected: %s, got: %s)', var_export($widget, TRUE), var_export($expected_value, TRUE), var_export($values[$widget], TRUE))); } } @@ -475,7 +471,7 @@ public function testSelect() { 'multiple_no_default_required' => ['three' => 'three'], ]; foreach ($expected as $key => $value) { - $this->assertSame($value, $values[$key], new FormattableMarkup('@name: @actual is equal to @expected.', ['@name' => $key, '@actual' => var_export($values[$key], TRUE), '@expected' => var_export($value, TRUE)])); + $this->assertSame($value, $values[$key], sprintf('%s: %s is equal to %s.', $key, var_export($values[$key], TRUE), var_export($value, TRUE))); } } @@ -775,7 +771,7 @@ public function testDisabledElements() { // the disabled container. $actual_count = count($disabled_elements); $expected_count = 44; - $this->assertEquals($expected_count, $actual_count, new FormattableMarkup('Found @actual elements with disabled property (expected @expected).', ['@actual' => count($disabled_elements), '@expected' => $expected_count])); + $this->assertEquals($expected_count, $actual_count, sprintf('Found %s elements with disabled property (expected %s).', count($disabled_elements), $expected_count)); // Mink does not "see" hidden elements, so we need to set the value of the // hidden element directly. @@ -812,7 +808,7 @@ public function assertFormValuesDefault(array $values, array $form): void { // Checkboxes values are not filtered out. $values[$key] = array_filter($values[$key]); } - $this->assertSame($expected_value, $values[$key], new FormattableMarkup('Default value for %type: expected %expected, returned %returned.', ['%type' => $key, '%expected' => var_export($expected_value, TRUE), '%returned' => var_export($values[$key], TRUE)])); + $this->assertSame($expected_value, $values[$key], sprintf('Default value for %s: expected %s, returned %s.', $key, var_export($expected_value, TRUE), var_export($values[$key], TRUE))); } // Recurse children. diff --git a/core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php b/core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php index be761873891c..bd4ae66efd0a 100644 --- a/core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php +++ b/core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\system\Functional\Menu; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Utility\Html; use Drupal\Core\Url; @@ -97,13 +96,13 @@ protected function assertBreadcrumbParts($trail) { // No parts must be left, or an expected "Home" will always pass. $pass = ($pass && empty($parts)); - $this->assertTrue($pass, new FormattableMarkup('Expected breadcrumb %parts on @path but found %found.', [ - '%parts' => implode(' » ', $trail), - '%found' => implode(' » ', array_map(function (array $item) { + $this->assertTrue($pass, sprintf('Expected breadcrumb %s on %s but found %s.', + implode(' » ', $trail), + $this->getUrl(), + implode(' » ', array_map(function (array $item) { return $item['text']; }, $found)), - '@path' => $this->getUrl(), - ])); + )); } /** diff --git a/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php b/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php index 586f307c1f42..7c6918f87141 100644 --- a/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php +++ b/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\system\Functional\Module; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Config\InstallStorage; use Drupal\Core\Database\Database; use Drupal\Core\Config\FileStorage; @@ -137,12 +136,12 @@ public function assertModules(array $modules, $enabled) { $this->rebuildContainer(); foreach ($modules as $module) { if ($enabled) { - $message = 'Module "@module" is enabled.'; + $message = 'Module "%s" is enabled.'; } else { - $message = 'Module "@module" is not enabled.'; + $message = 'Module "%s" is not enabled.'; } - $this->assertEquals($enabled, $this->container->get('module_handler')->moduleExists($module), new FormattableMarkup($message, ['@module' => $module])); + $this->assertEquals($enabled, $this->container->get('module_handler')->moduleExists($module), sprintf($message, $module)); } } diff --git a/core/modules/views/tests/src/Functional/BulkFormTest.php b/core/modules/views/tests/src/Functional/BulkFormTest.php index 4998d51f8db2..a2cefcd79816 100644 --- a/core/modules/views/tests/src/Functional/BulkFormTest.php +++ b/core/modules/views/tests/src/Functional/BulkFormTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\views\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\BrowserTestBase; use Drupal\Tests\node\Traits\NodeCreationTrait; use Drupal\views\Views; @@ -85,7 +84,7 @@ public function testBulkForm() { foreach ($nodes as $node) { $changed_node = $node_storage->load($node->id()); - $this->assertTrue($changed_node->isSticky(), new FormattableMarkup('Node @nid got marked as sticky.', ['@nid' => $node->id()])); + $this->assertTrue($changed_node->isSticky(), "Node {$node->id()} got marked as sticky."); } $this->assertSession()->pageTextContains('Make content sticky was applied to 10 items.'); diff --git a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php index 9f6bb32a5875..a817161e95c8 100644 --- a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\views\Functional\Plugin; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\views\Functional\ViewTestBase; use Drupal\views\Views; use Drupal\views_test_data\Plugin\views\filter\FilterTest as FilterPlugin; @@ -99,7 +98,7 @@ public function testFilterQuery() { // Check that we have a single element, as a result of applying the '= John' // filter. - $this->assertCount(1, $view->result, new FormattableMarkup('Results were returned. @count results.', ['@count' => count($view->result)])); + $this->assertCount(1, $view->result, 'Results were returned. ' . count($view->result) . ' results.'); $view->destroy(); @@ -125,7 +124,7 @@ public function testFilterQuery() { // Check if we have the other elements in the dataset, as a result of // applying the '<> John' filter. - $this->assertCount(4, $view->result, new FormattableMarkup('Results were returned. @count results.', ['@count' => count($view->result)])); + $this->assertCount(4, $view->result, 'Results were returned. ' . count($view->result) . ' results.'); $view->destroy(); $view->initDisplay(); @@ -149,7 +148,7 @@ public function testFilterQuery() { $this->executeView($view); // Check if we have all 5 results. - $this->assertCount(5, $view->result, new FormattableMarkup('All @count results returned', ['@count' => count($view->displayHandlers)])); + $this->assertCount(5, $view->result, 'All ' . count($view->displayHandlers) . ' results returned'); } /** diff --git a/core/modules/views/tests/src/Functional/Wizard/MenuTest.php b/core/modules/views/tests/src/Functional/Wizard/MenuTest.php index 74fc7dc212e8..a0ede2ac3eb2 100644 --- a/core/modules/views/tests/src/Functional/Wizard/MenuTest.php +++ b/core/modules/views/tests/src/Functional/Wizard/MenuTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\views\Functional\Wizard; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Url; /** @@ -50,7 +49,7 @@ public function testMenus() { /** @var \Drupal\Core\Menu\MenuLinkInterface $link */ $link = $menu_link_manager->createInstance('views_view:views.' . $view['id'] . '.page_1'); $url = $link->getUrlObject(); - $this->assertEquals('view.' . $view['id'] . '.page_1', $url->getRouteName(), new FormattableMarkup('Found a link to %path in the main menu', ['%path' => $view['page[path]']])); + $this->assertEquals('view.' . $view['id'] . '.page_1', $url->getRouteName(), "Found a link to {$view['page[path]']} in the main menu"); $metadata = $link->getMetaData(); $this->assertEquals(['view_id' => $view['id'], 'display_id' => 'page_1'], $metadata); } diff --git a/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php b/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php index b88dd0b0c4d8..648f50f06e8a 100644 --- a/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php +++ b/core/modules/views_ui/tests/src/Functional/CustomBooleanTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\views_ui\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\views\Views; /** @@ -104,8 +103,8 @@ public function testCustomOption() { $view = Views::getView('test_view'); $output = $view->preview(); $output = \Drupal::service('renderer')->renderRoot($output); - $this->{$values['test']}($values['true'], (string) $output, new FormattableMarkup('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type])); - $this->{$values['test']}($values['false'], (string) $output, new FormattableMarkup('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type])); + $this->{$values['test']}($values['true'], (string) $output, "Expected custom boolean TRUE value {$values['true']} in output for $type"); + $this->{$values['test']}($values['false'], (string) $output, "Expected custom boolean FALSE value {$values['false']} in output for $type"); } } @@ -178,8 +177,8 @@ public function testCustomOptionTemplate() { $view = Views::getView('test_view'); $output = $view->preview(); $output = \Drupal::service('renderer')->renderRoot($output); - $this->{$values['test']}($values['true'], (string) $output, new FormattableMarkup('Expected custom boolean TRUE value %value in output for %type', ['%value' => $values['true'], '%type' => $type])); - $this->{$values['test']}($values['false'], (string) $output, new FormattableMarkup('Expected custom boolean FALSE value %value in output for %type', ['%value' => $values['false'], '%type' => $type])); + $this->{$values['test']}($values['true'], (string) $output, "Expected custom boolean TRUE value {$values['true']} in output for $type"); + $this->{$values['test']}($values['false'], (string) $output, "Expected custom boolean FALSE value {$values['false']} in output for $type"); // Assert that we are using the correct template. $this->assertStringContainsString('llama', (string) $output); diff --git a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php index 246b555153f2..bfe1fa7221d8 100644 --- a/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php +++ b/core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php @@ -10,7 +10,6 @@ use Drupal\KernelTests\AssertConfigTrait; use Drupal\Tests\BrowserTestBase; use Drupal\Core\Session\AccountInterface; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\SchemaCheckTestTrait; use Symfony\Component\Validator\ConstraintViolation; @@ -288,7 +287,7 @@ protected function drupalLoginWithPassword(AccountInterface $account, $password) // @see ::drupalUserIsLoggedIn() $account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']); - $this->assertTrue($this->drupalUserIsLoggedIn($account), new FormattableMarkup('User %name successfully logged in.', ['%name' => $account->getAccountName()])); + $this->assertTrue($this->drupalUserIsLoggedIn($account), "User {$account->getAccountName()} successfully logged in."); $this->loggedInUser = $account; $this->container->get('current_user')->setAccount($account); -- GitLab