Verified Commit 5ccf44d2 authored by quietone's avatar quietone
Browse files

Issue #3418236 by mstrelan, smustgrave: Fix strict type errors: Convert...

Issue #3418236 by mstrelan, smustgrave: Fix strict type errors: Convert remaining usages of FormattableMarkup to strings in core Functional tests
parent 554598a5
Loading
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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.
+1 −2
Original line number Diff line number Diff line
@@ -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."
        );
      }

+1 −2
Original line number Diff line number Diff line
@@ -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);
      }
    }
+1 −2
Original line number Diff line number Diff line
@@ -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']);
+2 −3
Original line number Diff line number Diff line
@@ -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).");
      }
    }