function PathContentModerationTest::setUp

Same name in other branches
  1. 9 core/modules/path/tests/src/Functional/PathContentModerationTest.php \Drupal\Tests\path\Functional\PathContentModerationTest::setUp()
  2. 8.9.x core/modules/path/tests/src/Functional/PathContentModerationTest.php \Drupal\Tests\path\Functional\PathContentModerationTest::setUp()
  3. 10 core/modules/path/tests/src/Functional/PathContentModerationTest.php \Drupal\Tests\path\Functional\PathContentModerationTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/path/tests/src/Functional/PathContentModerationTest.php, line 40

Class

PathContentModerationTest
Tests path aliases with Content Moderation.

Namespace

Drupal\Tests\path\Functional

Code

protected function setUp() : void {
    parent::setUp();
    static::createLanguageFromLangcode('fr');
    $this->rebuildContainer();
    // Created a content type.
    $this->drupalCreateContentType([
        'name' => 'moderated',
        'type' => 'moderated',
    ]);
    // Set the content type as moderated.
    $workflow = $this->createEditorialWorkflow();
    $workflow->getTypePlugin()
        ->addEntityTypeAndBundle('node', 'moderated');
    $workflow->save();
    $this->drupalLogin($this->drupalCreateUser([
        'administer workflows',
        'access administration pages',
        'administer content types',
        'administer content translation',
        'administer nodes',
        'view latest version',
        'view any unpublished content',
        'access content overview',
        'use editorial transition create_new_draft',
        'use editorial transition publish',
        'use editorial transition archive',
        'use editorial transition archived_draft',
        'use editorial transition archived_published',
        'administer languages',
        'administer site configuration',
        'administer url aliases',
        'create url aliases',
        'view the administration theme',
        'translate any entity',
        'create content translations',
        'create moderated content',
        'edit own moderated content',
    ]));
    // Enable URL language detection and selection.
    $edit = [
        'language_interface[enabled][language-url]' => 1,
    ];
    $this->drupalGet('admin/config/regional/language/detection');
    $this->submitForm($edit, 'Save settings');
    // Enable translation for page.
    $this->enableContentTranslation('node', 'moderated');
}

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