function CommentTranslationUITest::doTestPublishedStatus
Same name in other branches
- 9 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::doTestPublishedStatus()
- 10 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::doTestPublishedStatus()
- 11.x core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::doTestPublishedStatus()
Overrides ContentTranslationUITestBase::doTestPublishedStatus
File
-
core/
modules/ comment/ tests/ src/ Functional/ CommentTranslationUITest.php, line 139
Class
- CommentTranslationUITest
- Tests the Comment Translation UI.
Namespace
Drupal\Tests\comment\FunctionalCode
protected function doTestPublishedStatus() {
$entity_type_manager = \Drupal::entityTypeManager();
$storage = $entity_type_manager->getStorage($this->entityTypeId);
$storage->resetCache();
$entity = $storage->load($this->entityId);
// Unpublish translations.
foreach ($this->langcodes as $index => $langcode) {
if ($index > 0) {
$edit = [
'status' => 0,
];
$url = $entity->toUrl('edit-form', [
'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.');
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.