NullBackendTest.php

Same filename in other branches
  1. 9 core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php
  2. 8.9.x core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php
  3. 11.x core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php

Namespace

Drupal\Tests\Core\Cache

File

core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Cache;

use Drupal\Core\Cache\NullBackend;
use Drupal\Tests\UnitTestCase;

/**
 * Tests the cache NullBackend.
 *
 * @group Cache
 */
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));
    }

}

Classes

Title Deprecated Summary
NullBackendTest Tests the cache NullBackend.

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