You are here

protected function NodeAccessLanguageTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/NodeAccessLanguageTest.php \Drupal\node\Tests\NodeAccessLanguageTest::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/node/src/Tests/NodeAccessLanguageTest.php, line 30
Contains \Drupal\node\Tests\NodeAccessLanguageTest.

Class

NodeAccessLanguageTest
Tests node_access and db_select() with node_access tag functionality with multiple languages with a test node access module that is not language-aware.

Namespace

Drupal\node\Tests

Code

protected function setUp() {
  parent::setUp();
  node_access_test_add_field(NodeType::load('page'));

  // After enabling a node access module, the access table has to be rebuild.
  node_access_rebuild();

  // Enable the private node feature of the node_access_test module.
  \Drupal::state()
    ->set('node_access_test.private', TRUE);

  // Add Hungarian, Catalan and Croatian.
  ConfigurableLanguage::createFromLangcode('hu')
    ->save();
  ConfigurableLanguage::createFromLangcode('ca')
    ->save();
  ConfigurableLanguage::createFromLangcode('hr')
    ->save();
}