diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php index 737f1ef247e7e7093a496ceb046d43160e765c56..fc4eed64ccaf455ff3062f437d62fb8a2a563f4a 100644 --- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php +++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php @@ -3,7 +3,6 @@ namespace Drupal\Core\Test; use Drupal\Component\FileCache\FileCacheFactory; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Utility\Environment; use Drupal\Core\Config\Development\ConfigSchemaChecker; use Drupal\Core\Config\FileStorage; @@ -474,7 +473,7 @@ protected function installModulesFromClassProperty(ContainerInterface $container $modules = array_unique($modules); try { $success = $container->get('module_installer')->install($modules, TRUE); - $this->assertTrue($success, new FormattableMarkup('Enabled modules: %modules', ['%modules' => implode(', ', $modules)])); + $this->assertTrue($success, 'Enabled modules: ' . implode(', ', $modules)); } catch (MissingDependencyException $e) { // The exception message has all the details. diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php index 689a006b9f3e160d4f2625ebece36c89c75cd047..c2035dcb2fb6b0ca82704b5c697400b99f9f95f3 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\content_translation\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityChangedInterface; use Drupal\Core\Entity\EntityInterface; @@ -576,7 +575,7 @@ protected function doTestTranslationChanged() { $entity = $storage->load($this->entityId); $this->assertEquals( $entity->getChangedTimeAcrossTranslations(), $entity->getTranslation($langcode)->getChangedTime(), - new FormattableMarkup('Changed time for language %language is the latest change over all languages.', ['%language' => $language->getName()]) + "Changed time for language {$language->getName()} is the latest change over all languages." ); } diff --git a/core/modules/system/tests/src/Functional/Form/CheckboxTest.php b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php index a16190802d6a21d34939fea6d0552785f2319947..4bd82849b0378fb53e9b9bd5becc239d9f53d2fc 100644 --- a/core/modules/system/tests/src/Functional/Form/CheckboxTest.php +++ b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\system\Functional\Form; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\BrowserTestBase; /** @@ -55,7 +54,7 @@ public function testFormCheckbox() { $checked = ($default_value === '1foobar'); } $checked_in_html = str_contains($form, 'checked'); - $message = new FormattableMarkup('#default_value is %default_value #return_value is %return_value.', ['%default_value' => var_export($default_value, TRUE), '%return_value' => var_export($return_value, TRUE)]); + $message = '#default_value is ' . var_export($default_value, TRUE) . ' #return_value is ' . var_export($return_value, TRUE) . '.'; $this->assertSame($checked, $checked_in_html, $message); } } diff --git a/core/modules/tour/tests/src/Functional/TourTestBase.php b/core/modules/tour/tests/src/Functional/TourTestBase.php index eea6f3a0a69a23eccee54840d7dc047a4162b0c3..fd65676afc9cd05487c15d9159f3b1077c4fbc08 100644 --- a/core/modules/tour/tests/src/Functional/TourTestBase.php +++ b/core/modules/tour/tests/src/Functional/TourTestBase.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\tour\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\BrowserTestBase; /** @@ -61,7 +60,7 @@ public function assertTourTips(array $tips = [], bool $expectEmpty = FALSE) { foreach ($tips as $tip) { if (!empty($tip['data-id'])) { $elements = $this->getSession()->getPage()->findAll('css', '#' . $tip['data-id']); - $this->assertCount(1, $elements, new FormattableMarkup('Found corresponding page element for tour tip with id #%data-id', ['%data-id' => $tip['data-id']])); + $this->assertCount(1, $elements, sprintf('Found corresponding page element for tour tip with id #%s', $tip['data-id'])); } elseif (!empty($tip['data-class'])) { $elements = $this->getSession()->getPage()->findAll('css', '.' . $tip['data-class']); diff --git a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php index 6583130265469d8d04f353b875c5a0e4d4d355d0..d55853dbc81360ca6b86a4642e328f6a99cb3796 100644 --- a/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php +++ b/core/modules/views/tests/src/Functional/Handler/FieldWebTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\views\Functional\Handler; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Utility\Html; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Render\RenderContext; @@ -637,10 +636,10 @@ public function testTextRendering() { }); if ($tuple['trimmed']) { - $this->assertNotSubString($output, $tuple['value'], new FormattableMarkup('The untrimmed value (@untrimmed) should not appear in the trimmed output (@output).', ['@untrimmed' => $tuple['value'], '@output' => $output])); + $this->assertNotSubString($output, $tuple['value'], "The untrimmed value ({$tuple['value']}) should not appear in the trimmed output ($output)."); } if (!empty($tuple['trimmed_value'])) { - $this->assertSubString($output, $tuple['trimmed_value'], new FormattableMarkup('The trimmed value (@trimmed) should appear in the trimmed output (@output).', ['@trimmed' => $tuple['trimmed_value'], '@output' => $output])); + $this->assertSubString($output, $tuple['trimmed_value'], "The trimmed value ({$tuple['trimmed_value']}) should appear in the trimmed output ($output)."); } }