function NodeAccessLanguageTest::setUp

Same name in other branches
  1. 9 core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php \Drupal\Tests\node\Kernel\NodeAccessLanguageTest::setUp()
  2. 10 core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php \Drupal\Tests\node\Kernel\NodeAccessLanguageTest::setUp()
  3. 11.x core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php \Drupal\Tests\node\Kernel\NodeAccessLanguageTest::setUp()

Overrides NodeAccessTestBase::setUp

File

core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php, line 27

Class

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

Namespace

Drupal\Tests\node\Kernel

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.