KernelTestSharedContainerTest.php
Namespace
Drupal\KernelTestsFile
-
core/
tests/ Drupal/ KernelTests/ KernelTestSharedContainerTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\KernelTests;
use Drupal\TestTools\Attribute\ShareEnvironment;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\Attributes\TestWith;
/**
* Tests that the container is shared between kernel test methods.
*/
class KernelTestSharedContainerTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'container_rebuild_test',
];
/**
* Tests the number of container builds for each iteration of a test.
*/
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);
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| KernelTestSharedContainerTest | Tests that the container is shared between kernel test methods. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.