public function CacheCollectorTest::testUpdateCacheLockFail in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php \Drupal\Tests\Core\Cache\CacheCollectorTest::testUpdateCacheLockFail()
Tests updating the cache when the lock acquire fails.
File
- core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheCollectorTest.php, line 204 - Contains \Drupal\Tests\Core\Cache\CacheCollectorTest.
Class
- CacheCollectorTest
- @coversDefaultClass \Drupal\Core\Cache\CacheCollector @group Cache
Namespace
Drupal\Tests\Core\CacheCode
public function testUpdateCacheLockFail() {
$key = $this
->randomMachineName();
$value = $this
->randomMachineName();
$this->collector
->setCacheMissData($key, $value);
$this->collector
->get($key);
// The lock acquire returns false, so the method should abort.
$this->lock
->expects($this
->once())
->method('acquire')
->with($this->cid . ':Drupal\\Core\\Cache\\CacheCollector')
->will($this
->returnValue(FALSE));
$this->cacheBackend
->expects($this
->never())
->method('set');
// Destruct the object to trigger the update data process.
$this->collector
->destruct();
}