You are here

protected function ViewUnpublishedMultilingualTest::setUp in view_unpublished 8

Sets up the test.

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ViewUnpublishedMultilingualTest.php, line 43

Class

ViewUnpublishedMultilingualTest
Tests the View Unpublished module on a multilingual site.

Namespace

Drupal\Tests\view_unpublished\Functional

Code

protected function setUp() {
  parent::setUp();

  // Create Basic page node type.
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);
  $this->adminUser = $this
    ->drupalCreateUser([
    'access administration pages',
    'administer languages',
    'administer content types',
    'administer nodes',
    'create page content',
    'edit any page content',
    'translate any entity',
    'create content translations',
  ]);
  $this
    ->drupalLogin($this->adminUser);
  ConfigurableLanguage::createFromLangcode('it')
    ->save();

  // Enable translation for the current entity type and ensure the change is
  // picked up.
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'page', TRUE);
  \Drupal::service('router.builder')
    ->rebuild();
}