function ModeratedContentViewTest::testModeratedContentPageMultilingual

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php \Drupal\Tests\content_moderation\Functional\ModeratedContentViewTest::testModeratedContentPageMultilingual()
  2. 8.9.x core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php \Drupal\Tests\content_moderation\Functional\ModeratedContentViewTest::testModeratedContentPageMultilingual()
  3. 11.x core/modules/content_moderation/tests/src/Functional/ModeratedContentViewTest.php \Drupal\Tests\content_moderation\Functional\ModeratedContentViewTest::testModeratedContentPageMultilingual()

Tests the moderated content page with multilingual content.

File

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

Class

ModeratedContentViewTest
Tests moderated content administration page functionality.

Namespace

Drupal\Tests\content_moderation\Functional

Code

public function testModeratedContentPageMultilingual() : void {
    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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.