diff --git a/core/lib/Drupal/Core/Cache/NullBackend.php b/core/lib/Drupal/Core/Cache/NullBackend.php index c3da5d70a125e17141a1520e8cbdcee2efbc60a2..0408fc3efad2d0bda575216c2632e6bf4b91abf7 100644 --- a/core/lib/Drupal/Core/Cache/NullBackend.php +++ b/core/lib/Drupal/Core/Cache/NullBackend.php @@ -42,7 +42,7 @@ function getMultiple(&$cids) { /** * Implements Drupal\Core\Cache\CacheBackendInterface::set(). */ - function set($cid, $data, $expire = CACHE_PERMANENT) {} + function set($cid, $data, $expire = CACHE_PERMANENT, array $tags = array()) {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::delete(). @@ -74,6 +74,11 @@ function expire() {} */ function garbageCollection() {} + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::invalidateTags(). + */ + public function invalidateTags(array $tags) {} + /** * Implements Drupal\Core\Cache\CacheBackendInterface::isEmpty(). */ diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/NullBackendTest.php b/core/modules/system/lib/Drupal/system/Tests/Cache/NullBackendTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5a42e5defb622d8869f37e2c96769e4155c83a35 --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/NullBackendTest.php @@ -0,0 +1,38 @@ + '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)); + } +}