X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcontent_translation%2Fsrc%2FTests%2FContentTranslationUITestBase.php;fp=web%2Fcore%2Fmodules%2Fcontent_translation%2Fsrc%2FTests%2FContentTranslationUITestBase.php;h=ae833955dbefd709742f8c27d44e7cdd050654d3;hp=e7a7dfc9ddff08e88c4ae368433898457fa889d4;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php b/web/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php index e7a7dfc9d..ae833955d 100644 --- a/web/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php +++ b/web/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php @@ -9,7 +9,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; use Drupal\language\Entity\ConfigurableLanguage; -use Drupal\Component\Utility\SafeMarkup; +use Drupal\Component\Render\FormattableMarkup; use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait; /** @@ -37,8 +37,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase { protected $testLanguageSelector = TRUE; /** - * Flag that tells whether the HTML escaping of all languages works or not - * after SafeMarkup change. + * Flag to determine if "all languages" rendering is tested. * * @var bool */ @@ -113,12 +112,11 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase { $add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [ $entity->getEntityTypeId() => $entity->id(), 'source' => $default_langcode, - 'target' => $langcode + 'target' => $langcode, ], ['language' => $language]); $this->drupalPostForm($add_url, $this->getEditValues($values, $langcode), $this->getFormSubmitActionForNewTranslation($entity, $langcode)); - // Assert that HTML is escaped in "all languages" in UI after SafeMarkup - // change. + // Assert that HTML is not escaped unexpectedly. if ($this->testHTMLEscapeForAllLanguages) { $this->assertNoRaw('<span class="translation-entity-all-languages">(all languages)</span>'); $this->assertRaw('(all languages)'); @@ -141,10 +139,10 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase { $author_field_name = $entity->hasField('content_translation_uid') ? 'content_translation_uid' : 'uid'; if ($entity->getFieldDefinition($author_field_name)->isTranslatable()) { $this->assertEqual($metadata_target_translation->getAuthor()->id(), $this->translator->id(), - SafeMarkup::format('Author of the target translation @langcode correctly stored for translatable owner field.', ['@langcode' => $langcode])); + new FormattableMarkup('Author of the target translation @langcode correctly stored for translatable owner field.', ['@langcode' => $langcode])); $this->assertNotEqual($metadata_target_translation->getAuthor()->id(), $metadata_source_translation->getAuthor()->id(), - SafeMarkup::format('Author of the target translation @target different from the author of the source translation @source for translatable owner field.', + new FormattableMarkup('Author of the target translation @target different from the author of the source translation @source for translatable owner field.', ['@target' => $langcode, '@source' => $default_langcode])); } else { @@ -154,7 +152,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase { $created_field_name = $entity->hasField('content_translation_created') ? 'content_translation_created' : 'created'; if ($entity->getFieldDefinition($created_field_name)->isTranslatable()) { $this->assertTrue($metadata_target_translation->getCreatedTime() > $metadata_source_translation->getCreatedTime(), - SafeMarkup::format('Translation creation timestamp of the target translation @target is newer than the creation timestamp of the source translation @source for translatable created field.', + new FormattableMarkup('Translation creation timestamp of the target translation @target is newer than the creation timestamp of the source translation @source for translatable created field.', ['@target' => $langcode, '@source' => $default_langcode])); } else { @@ -178,7 +176,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase { $add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [ $entity->getEntityTypeId() => $entity->id(), 'source' => $default_langcode, - 'target' => $langcode + 'target' => $langcode, ], ['language' => $language]); // This does not save anything, it merely reloads the form and fills in the // fields with the values from the different source language. @@ -192,7 +190,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase { $add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [ $entity->getEntityTypeId() => $entity->id(), 'source' => $source_langcode, - 'target' => $langcode + 'target' => $langcode, ], ['language' => $language]); $this->drupalPostForm($add_url, $edit, $this->getFormSubmitActionForNewTranslation($entity, $langcode)); $storage->resetCache([$this->entityId]);