You are here

protected function TranslationOperationTargetLanguageTest::setUp in Translation Views 8

Overrides ViewTestBase::setUp

File

tests/src/Functional/TranslationOperationTargetLanguageTest.php, line 61

Class

TranslationOperationTargetLanguageTest
Class TranslationOperationTargetLanguageTest.

Namespace

Drupal\Tests\translation_views\Functional

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);
  $this->adminUser = $this
    ->createUser([], 'test_admin', TRUE);
  $this
    ->drupalLogin($this->adminUser);
  $this->defaultLangcode = \Drupal::languageManager()
    ->getDefaultLanguage()
    ->getId();

  // Set up testing views.
  ViewTestData::createTestViews(get_class($this), [
    'translation_views_test_views',
  ]);
  try {
    $this
      ->setUpLanguages();
  } catch (EntityStorageException $e) {
    $this
      ->verbose($e
      ->getMessage());
  }

  // Enable translation for Article nodes.
  $this
    ->enableTranslation('node', 'article');

  // Create testing node.
  $this
    ->drupalPostForm('node/add/article', [
    'title[0][value]' => $this
      ->randomString(),
  ], 'Save');
  $this
    ->drupalLogout();
}