/** * Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertPublishedStatus(). */ protected function assertPublishedStatus() { parent::assertPublishedStatus(); $entity = entity_load($this->entityTypeId, $this->entityId); $user = $this->drupalCreateUser(array('access comments')); $this->drupalLogin($user); $languages = $this->container->get('language_manager')->getLanguages(); // Check that simple users cannot see unpublished field translations. $path = $entity->getSystemPath(); foreach ($this->langcodes as $index => $langcode) { $translation = $this->getTranslation($entity, $langcode); $value = $this->getValue($translation, 'comment_body', $langcode); $this->drupalGet($path, array('language' => $languages[$langcode])); if ($index > 0) { $this->assertNoRaw($value, 'Unpublished field translation is not shown.'); } else { $this->assertRaw($value, 'Published field translation is shown.'); } } // Login as translator again to ensure subsequent tests do not break. $this->drupalLogin($this->translator); }