You are here

protected function ContentTranslationOperationsTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php \Drupal\content_translation\Tests\ContentTranslationOperationsTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides NodeTestBase::setUp

File

core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php, line 42
Contains \Drupal\content_translation\Tests\ContentTranslationOperationsTest.

Class

ContentTranslationOperationsTest
Tests the content translation operations available in the content listing.

Namespace

Drupal\content_translation\Tests

Code

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

  // Enable additional languages.
  $langcodes = [
    'es',
    'ast',
  ];
  foreach ($langcodes as $langcode) {
    ConfigurableLanguage::createFromLangcode($langcode)
      ->save();
  }

  // Enable translation for the current entity type and ensure the change is
  // picked up.
  \Drupal::service('content_translation.manager')
    ->setEnabled('node', 'article', TRUE);
  drupal_static_reset();
  \Drupal::entityManager()
    ->clearCachedDefinitions();
  \Drupal::service('router.builder')
    ->rebuild();
  \Drupal::service('entity.definition_update_manager')
    ->applyUpdates();
  $this->baseUser1 = $this
    ->drupalCreateUser([
    'access content overview',
  ]);
  $this->baseUser2 = $this
    ->drupalCreateUser([
    'access content overview',
    'create content translations',
    'update content translations',
    'delete content translations',
  ]);
}