You are here

protected function NodeAccessLanguageTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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()

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