function KernelTestSharedContainerTest::testContainerRebuilds

Tests the number of container builds for each iteration of a test.

Attributes

#[TestWith([ 1, 1, ])] #[TestWith([ 2, 1, ])] #[TestWith([ 3, 1, ])]

File

core/tests/Drupal/KernelTests/KernelTestSharedContainerTest.php, line 30

Class

KernelTestSharedContainerTest
Tests that the container is shared between kernel test methods.

Namespace

Drupal\KernelTests

Code

public function testContainerRebuilds($iteration, $container_rebuilds) : void {
  $this->assertSame($container_rebuilds, $this->container
    ->get('state')
    ->get('container_rebuild_test.count', 0), 'Container rebuilt once, iteration ' . $iteration);
}

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