protected function EntityTranslationUITest::assertPublishedStatus

Tests the translation publishing status.

2 calls to EntityTranslationUITest::assertPublishedStatus()
CommentTranslationUITest::assertPublishedStatus in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::assertPublishedStatus().
EntityTranslationUITest::testTranslationUI in drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php
Tests the basic translation UI.
2 methods override EntityTranslationUITest::assertPublishedStatus()

File

drupal/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php, line 138
Definition of Drupal\entity\Tests\EntityTranslationUITest.

Class

EntityTranslationUITest
Tests the Entity Translation UI.

Namespace

Drupal\translation_entity\Tests

Code

protected function assertPublishedStatus() {
  $entity = entity_load($this->entityType, $this->entityId, TRUE);
  $path = $this->controller
    ->getEditPath($entity);

  // Unpublish translations.
  foreach ($this->langcodes as $index => $langcode) {
    if ($index > 0) {
      $edit = array(
        'translation_entity[status]' => FALSE,
      );
      $this
        ->drupalPost($langcode . '/' . $path, $edit, $this
        ->getFormSubmitAction($entity));
      $entity = entity_load($this->entityType, $this->entityId, TRUE);
      $this
        ->assertFalse($entity->translation[$langcode]['status'], 'The translation has been correctly unpublished.');
    }
  }

  // Check that the last published translation cannot be unpublished.
  $this
    ->drupalGet($path);
  $this
    ->assertFieldByXPath('//input[@name="translation_entity[status]" and @disabled="disabled"]', TRUE, 'The last translation is published and cannot be unpublished.');
}