unset($this->cachebackends
);
$this->
tearDownCacheBackend();
parent::
tearDown();
} /**
* Tests the get and set methods of Drupal\Core\Cache\CacheBackendInterface.
*/
public function testSetGet() { $backend =
$this->
getCacheBackend();
$this->
assertFalse($backend->
get('test1'
), "Backend does not contain data for cache id test1."
);
$with_backslash =
['foo' => '\Drupal\foo\Bar'
];
$backend->
set('test1',
$with_backslash);
$cached =
$backend->
get('test1'
);
$this->
assertIsObject($cached);
$this->
assertSame($with_backslash,
$cached->data
);
$this->
assertTrue($cached->valid, 'Item is marked as valid.'
);
// We need to round because microtime may be rounded up in the backend.
$this->
assertGreaterThanOrEqual(REQUEST_TIME,
$cached->created
);
$this->
assertLessThanOrEqual(round(microtime(TRUE
), 3
),
$cached->created
);