function ConfigEntityValidationTestBaseUnsharedTest::testEntityComesFromSetUp

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBaseUnsharedTest.php \Drupal\KernelTests\Core\Config\ConfigEntityValidationTestBaseUnsharedTest::testEntityComesFromSetUp()

Tests that the entity assigned after ::setUp() is the one under test.

The base class reloads ::$entity only for a shared environment. Reloading it here would throw, because nothing recorded which entity to load.

File

core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBaseUnsharedTest.php, line 47

Class

ConfigEntityValidationTestBaseUnsharedTest
Tests a subclass that does not share its environment.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testEntityComesFromSetUp() : void {
  $this->assertFalse(static::sharesEnvironment());
  $this->assertSame('test', $this->entity
    ->id());
  $this->assertFalse($this->entity
    ->isNew());
}

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