protected function NodeTranslationUITest::doTestPublishedStatus in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/node/src/Tests/NodeTranslationUITest.php \Drupal\node\Tests\NodeTranslationUITest::doTestPublishedStatus()
Tests the translation publishing status.
Overrides ContentTranslationUITestBase::doTestPublishedStatus
File
- core/
modules/ node/ src/ Tests/ NodeTranslationUITest.php, line 154 - Contains \Drupal\node\Tests\NodeTranslationUITest.
Class
- NodeTranslationUITest
- Tests the Node Translation UI.
Namespace
Drupal\node\TestsCode
protected function doTestPublishedStatus() {
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
$languages = $this->container
->get('language_manager')
->getLanguages();
$actions = array(
t('Save and keep published'),
t('Save and unpublish'),
);
foreach ($actions as $index => $action) {
// (Un)publish the node translations and check that the translation
// statuses are (un)published accordingly.
foreach ($this->langcodes as $langcode) {
$options = array(
'language' => $languages[$langcode],
);
$url = $entity
->urlInfo('edit-form', $options);
$this
->drupalPostForm($url, array(), $action . $this
->getFormSubmitSuffix($entity, $langcode), $options);
}
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
foreach ($this->langcodes as $langcode) {
// The node is created as unpublished thus we switch to the published
// status first.
$status = !$index;
$translation = $entity
->getTranslation($langcode);
$this
->assertEqual($status, $this->manager
->getTranslationMetadata($translation)
->isPublished(), 'The translation has been correctly unpublished.');
}
}
}