protected function ContentTranslationUITestBase::doTestPublishedStatus in Drupal 8
Same name in this branch
- 8 core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php \Drupal\content_translation\Tests\ContentTranslationUITestBase::doTestPublishedStatus()
- 8 core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::doTestPublishedStatus()
Same name and namespace in other branches
- 9 core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::doTestPublishedStatus()
- 10 core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::doTestPublishedStatus()
Tests the translation publishing status.
1 call to ContentTranslationUITestBase::doTestPublishedStatus()
- ContentTranslationUITestBase::testTranslationUI in core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationUITestBase.php - Tests the basic translation UI.
3 methods override ContentTranslationUITestBase::doTestPublishedStatus()
- CommentTranslationUITest::doTestPublishedStatus in core/
modules/ comment/ tests/ src/ Functional/ CommentTranslationUITest.php - Tests the translation publishing status.
- NodeTranslationUITest::doTestPublishedStatus in core/
modules/ node/ tests/ src/ Functional/ NodeTranslationUITest.php - Tests the translation publishing status.
- TermTranslationUITest::doTestPublishedStatus in core/
modules/ taxonomy/ tests/ src/ Functional/ TermTranslationUITest.php - Tests the translation publishing status.
File
- core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationUITestBase.php, line 281
Class
- ContentTranslationUITestBase
- Tests the Content Translation UI.
Namespace
Drupal\Tests\content_translation\FunctionalCode
protected function doTestPublishedStatus() {
$storage = $this->container
->get('entity_type.manager')
->getStorage($this->entityTypeId);
$storage
->resetCache([
$this->entityId,
]);
$entity = $storage
->load($this->entityId);
// Unpublish translations.
foreach ($this->langcodes as $index => $langcode) {
if ($index > 0) {
$url = $entity
->toUrl('edit-form', [
'language' => ConfigurableLanguage::load($langcode),
]);
$edit = [
'content_translation[status]' => FALSE,
];
$this
->drupalPostForm($url, $edit, $this
->getFormSubmitAction($entity, $langcode));
$storage = $this->container
->get('entity_type.manager')
->getStorage($this->entityTypeId);
$storage
->resetCache([
$this->entityId,
]);
$entity = $storage
->load($this->entityId);
$this
->assertFalse($this->manager
->getTranslationMetadata($entity
->getTranslation($langcode))
->isPublished(), 'The translation has been correctly unpublished.');
}
}
// Check that the last published translation cannot be unpublished.
$this
->drupalGet($entity
->toUrl('edit-form'));
$this
->assertFieldByXPath('//input[@name="content_translation[status]" and @disabled="disabled"]', TRUE, 'The last translation is published and cannot be unpublished.');
}