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. 8.9.x 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 36

Class

NodeAccessLanguageTest
Tests multilingual node access with a module that is not language-aware.

Namespace

Drupal\Tests\node\Kernel

Code

protected function setUp() : void {
    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.