protected function UnitTestCase::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::setUp()
- 9 core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::setUp()
92 calls to UnitTestCase::setUp()
- AcceptHeaderMatcherTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Routing/ AcceptHeaderMatcherTest.php - AccessManagerTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessManagerTest.php - AccessResultTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultTest.php - AjaxBasePageNegotiatorTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Theme/ AjaxBasePageNegotiatorTest.php - AssetResolverTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Asset/ AssetResolverTest.php
146 methods override UnitTestCase::setUp()
- AcceptHeaderMatcherTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Routing/ AcceptHeaderMatcherTest.php - AccessManagerTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessManagerTest.php - AccessResultTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultTest.php - AjaxBasePageNegotiatorTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Theme/ AjaxBasePageNegotiatorTest.php - AjaxRendererTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Controller/ AjaxRendererTest.php
File
- core/
tests/ Drupal/ Tests/ UnitTestCase.php, line 57
Class
- UnitTestCase
- Provides a base class and helpers for Drupal unit tests.
Namespace
Drupal\TestsCode
protected function setUp() : void {
parent::setUp();
// Ensure that an instantiated container in the global state of \Drupal from
// a previous test does not leak into this test.
\Drupal::unsetContainer();
// Ensure that the NullFileCache implementation is used for the FileCache as
// unit tests should not be relying on caches implicitly.
FileCacheFactory::setConfiguration([
FileCacheFactory::DISABLE_CACHE => TRUE,
]);
// Ensure that FileCacheFactory has a prefix.
FileCacheFactory::setPrefix('prefix');
$this->root = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)), 2);
}