diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php index e524359..4974edb 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php @@ -13,12 +13,15 @@ use Drupal\Core\Url; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Component\Utility\SafeMarkup; +use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait; /** * Tests the Content Translation UI. */ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase { + use AssertPageCacheContextsAndTagsTrait; + /** * The id of the entity being translated. * @@ -87,9 +90,14 @@ protected function doTestBasicTranslation() { ], array('language' => $language)); $this->drupalPostForm($add_url, $this->getEditValues($values, $langcode), $this->getFormSubmitActionForNewTranslation($entity, $langcode)); - // Get the entity and reset its cache, so that the new translation gets the + // Ensure that the content languge cache context is not yet added to the + // page. + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); + $this->drupalGet($entity->urlInfo()); + $this->assertCacheContexts(['languages:language_interface', 'theme' , 'user.permissions']); + + // Reset the cache of the entity, so that the new translation gets the // updated values. - $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); $metadata_source_translation = $this->manager->getTranslationMetadata($entity->getTranslation($default_langcode)); $metadata_target_translation = $this->manager->getTranslationMetadata($entity->getTranslation($langcode)); @@ -148,6 +156,12 @@ protected function doTestBasicTranslation() { ], array('language' => $language)); $this->drupalPostForm($add_url, $edit, $this->getFormSubmitActionForNewTranslation($entity, $langcode)); $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); + $this->drupalGet($entity->urlInfo()); + + // Ensure that the language content cache context has been added as there + // are translations. + $this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme' , 'user.permissions']); + $this->drupalGet($entity->urlInfo('drupal:content-translation-overview')); $this->assertText('Source language', 'Source language column correctly shown.');