protected function CommentTranslationUITest::doTestPublishedStatus in Drupal 8
Same name and namespace 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()
Tests the translation publishing status.
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.');
}
}
}