function ConfigEntityValidationTestBase::rememberEntityUnderTest

Same name and namespace in other branches
  1. main core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php \Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBase::rememberEntityUnderTest()

Records which entity the test methods of this class validate.

Only the process that built the shared state has the entity object. What the other processes need to reload it is stored in state, which for a shared environment is backed by the database.

File

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

Class

ConfigEntityValidationTestBase
Base class for testing validation of config entities.

Namespace

Drupal\KernelTests\Core\Config

Code

private function rememberEntityUnderTest() : void {
  \Drupal::keyValue(static::class)->set(self::ENTITY_UNDER_TEST, [
    $this->entity
      ->getEntityTypeId(),
    $this->entity
      ->id(),
  ]);
}

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