class NullBackendTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php \Drupal\Tests\Core\Cache\NullBackendTest
- 10 core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php \Drupal\Tests\Core\Cache\NullBackendTest
- 9 core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php \Drupal\Tests\Core\Cache\NullBackendTest
- 8.9.x core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php \Drupal\Tests\Core\Cache\NullBackendTest
Tests the cache NullBackend.
Attributes
#[Group('Cache')]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Cache\NullBackendTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of NullBackendTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ NullBackendTest.php, line 14
Namespace
Drupal\Tests\Core\CacheView source
class NullBackendTest extends UnitTestCase {
/**
* Tests that the NullBackend does not actually store variables.
*/
public function testNullBackend() : void {
$null_cache = new NullBackend('test');
$key = $this->randomMachineName();
$value = $this->randomMachineName();
$null_cache->set($key, $value);
$this->assertFalse($null_cache->get($key));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.