function KernelTestBase::sharesEnvironment

Returns whether this test class shares its environment between its methods.

Return value

bool TRUE if the test methods of this class share one environment.

See also

\Drupal\TestTools\Attribute\ShareEnvironment

9 calls to KernelTestBase::sharesEnvironment()
ConfigEntityValidationTestBase::setUp in core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php
ConfigEntityValidationTestBaseUnsharedTest::testEntityComesFromSetUp in core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBaseUnsharedTest.php
Tests that the entity assigned after ::setUp() is the one under test.
KernelTestBase::allocateSharedDatabase in core/tests/Drupal/KernelTests/KernelTestBase.php
Allocates one database prefix for the whole test class.
KernelTestBase::bootKernel in core/tests/Drupal/KernelTests/KernelTestBase.php
Bootstraps a kernel for a test.
KernelTestBase::getTestDatabase in core/tests/Drupal/KernelTests/KernelTestBase.php
Returns the test database for this test.

... See full list

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 320

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

protected static function sharesEnvironment() : bool {
  // The attribute is deliberately not inherited: every test class declares
  // for itself, as it already does for the PHPUnit attributes.
  return ShareEnvironment::isEnabledFor(static::class);
}

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