function PathContentModerationTest::setUp
Overrides BrowserTestBase::setUp
File
- 
              core/
modules/ path/ tests/ src/ Functional/ PathContentModerationTest.php, line 39  
Class
- PathContentModerationTest
 - Tests path aliases with Content Moderation.
 
Namespace
Drupal\Tests\path\FunctionalCode
protected function setUp() {
  parent::setUp();
  ConfigurableLanguage::createFromLangcode('fr')->save();
  $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->rootUser);
  // Enable URL language detection and selection.
  $edit = [
    'language_interface[enabled][language-url]' => 1,
  ];
  $this->drupalPostForm('admin/config/regional/language/detection', $edit, 'Save settings');
  // Enable translation for moderated node.
  $edit = [
    'entity_types[node]' => 1,
    'settings[node][moderated][translatable]' => 1,
    'settings[node][moderated][fields][path]' => 1,
    'settings[node][moderated][fields][body]' => 1,
    'settings[node][moderated][settings][language][language_alterable]' => 1,
  ];
  $this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
  \Drupal::entityTypeManager()->clearCachedDefinitions();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.