You are here

protected function CommentTranslationUITest::doTestPublishedStatus in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Tests/CommentTranslationUITest.php \Drupal\comment\Tests\CommentTranslationUITest::doTestPublishedStatus()

Tests the translation publishing status.

Overrides ContentTranslationUITestBase::doTestPublishedStatus

File

core/modules/comment/src/Tests/CommentTranslationUITest.php, line 130
Contains \Drupal\comment\Tests\CommentTranslationUITest.

Class

CommentTranslationUITest
Tests the Comment Translation UI.

Namespace

Drupal\comment\Tests

Code

protected function doTestPublishedStatus() {
  $entity_manager = \Drupal::entityManager();
  $storage = $entity_manager
    ->getStorage($this->entityTypeId);
  $storage
    ->resetCache();
  $entity = $storage
    ->load($this->entityId);

  // Unpublish translations.
  foreach ($this->langcodes as $index => $langcode) {
    if ($index > 0) {
      $edit = array(
        'status' => 0,
      );
      $url = $entity
        ->urlInfo('edit-form', array(
        'language' => ConfigurableLanguage::load($langcode),
      ));
      $this
        ->drupalPostForm($url, $edit, $this
        ->getFormSubmitAction($entity, $langcode));
      $storage
        ->resetCache();
      $entity = $storage
        ->load($this->entityId);
      $this
        ->assertFalse($this->manager
        ->getTranslationMetadata($entity
        ->getTranslation($langcode))
        ->isPublished(), 'The translation has been correctly unpublished.');
    }
  }
}