function ConfigEntityValidationTestBase::setUp

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php \Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase::setUp()
  2. 10 core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php \Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase::setUp()

Overrides KernelTestBase::setUp

4 calls to ConfigEntityValidationTestBase::setUp()
ConfigEntityValidationTestBaseUnsharedTest::setUp in core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBaseUnsharedTest.php
ContactFormValidationTest::setUp in core/modules/contact/tests/src/Kernel/ContactFormValidationTest.php
SearchPageValidationTest::setUp in core/modules/search/tests/src/Kernel/SearchPageValidationTest.php
ShortcutSetValidationTest::setUp in core/modules/shortcut/tests/src/Kernel/ShortcutSetValidationTest.php
4 methods override ConfigEntityValidationTestBase::setUp()
ConfigEntityValidationTestBaseUnsharedTest::setUp in core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBaseUnsharedTest.php
ContactFormValidationTest::setUp in core/modules/contact/tests/src/Kernel/ContactFormValidationTest.php
SearchPageValidationTest::setUp in core/modules/search/tests/src/Kernel/SearchPageValidationTest.php
ShortcutSetValidationTest::setUp in core/modules/shortcut/tests/src/Kernel/ShortcutSetValidationTest.php

File

core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php, line 92

Class

ConfigEntityValidationTestBase
Base class for testing validation of config entities.

Namespace

Drupal\KernelTests\Core\Config

Code

protected function setUp() : void {
  parent::setUp();
  if (!static::sharesEnvironment()) {
    // The environment is not shared, so it is built for this test method
    // only. ::setUpEnvironment() is never called by the parent class in that
    // case. Subclasses that assign ::$entity after calling this method keep
    // working, because nothing is reloaded here.
    $this->setUpEnvironment();
    return;
  }
  // The process that built the shared state still holds the entity it
  // created. Every test method that follows runs in its own process and
  // reloads it.
  if (isset($this->entity)) {
    $this->rememberEntityUnderTest();
  }
  else {
    $this->entity = $this->loadEntityUnderTest();
  }
}

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