class NullBackendTest

Tests the cache NullBackend.

@group Cache

Hierarchy

Expanded class hierarchy of NullBackendTest

File

drupal/core/tests/Drupal/Tests/Core/Cache/NullBackendTest.php, line 18
Definition of Drupal\Tests\Core\Cache\NullBackendTest.

Namespace

Drupal\Tests\Core\Cache
View source
class NullBackendTest extends UnitTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Cache NullBackend test',
      'description' => 'Tests the cache NullBackend.',
      'group' => 'Cache',
    );
  }

  /**
   * Tests that the NullBackend does not actually store variables.
   */
  function testNullBackend() {
    $null_cache = new NullBackend('test');
    $key = $this
      ->randomName();
    $value = $this
      ->randomName();
    $null_cache
      ->set($key, $value);
    $this
      ->assertTrue($null_cache
      ->isEmpty());
    $this
      ->assertFalse($null_cache
      ->get($key));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
NullBackendTest::getInfo public static function This method exists to support the simpletest UI runner. Overrides UnitTestCase::getInfo
NullBackendTest::testNullBackend function Tests that the NullBackend does not actually store variables.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed in array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::randomName public static function Generates a random string containing letters and numbers.