You are here

public function ModeratedContentViewTest::testModeratedContentPageMultilingual in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php \Drupal\Tests\content_moderation\Functional\ModeratedContentViewTest::testModeratedContentPageMultilingual()
  2. 10 core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php \Drupal\Tests\content_moderation\Functional\ModeratedContentViewTest::testModeratedContentPageMultilingual()

Test the moderated content page with multilingual content.

File

core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php, line 152

Class

ModeratedContentViewTest
Tests moderated content administration page functionality.

Namespace

Drupal\Tests\content_moderation\Functional

Code

public function testModeratedContentPageMultilingual() {
  ConfigurableLanguage::createFromLangcode('fr')
    ->save();
  $node = $this
    ->drupalCreateNode([
    'type' => 'article',
    'moderation_state' => 'published',
    'title' => 'en article published',
  ]);
  $node->title = 'en draft revision';
  $node->moderation_state = 'draft';
  $node
    ->save();
  $translation = Node::load($node
    ->id())
    ->addTranslation('fr');
  $translation->title = 'fr draft revision';
  $translation->moderation_state = 'draft';
  $translation
    ->save();
  $this
    ->drupalLogin($this->adminUser);

  // The moderated content view should show both the pending en draft revision
  // and the pending fr draft revision.
  $this
    ->drupalGet('admin/content/moderated');
  $this
    ->assertSession()
    ->linkExists('fr draft revision');
  $this
    ->assertSession()
    ->linkExists('en draft revision');
}