protected function ContentTranslationUITestBase::doTestPublishedStatus in Drupal 9
Same name and namespace in other branches
- 8 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 290
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
->drupalGet($url);
$this
->submitForm($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
->assertSession()
->fieldDisabled('content_translation[status]');
$this
->assertSession()
->fieldValueEquals('content_translation[status]', TRUE);
}