public function testPurgeByRequestSingleLocation()
{
$fs = $this->getFilesystemMock();
$this->store->setFilesystem($fs);
$locationId = 123;
$locationCacheDir = $this->store->getLocationCacheDir($locationId);
$staleCacheDir = str_replace(LocationAwareStore::LOCATION_CACHE_DIR, LocationAwareStore::LOCATION_STALE_CACHE_DIR, $locationCacheDir);
$fs->expects($this->any())->method('exists')->with($locationCacheDir)->will($this->returnValue(true));
$fs->expects($this->once())->method('mkdir')->with($staleCacheDir);
$fs->expects($this->once())->method('mirror')->with($locationCacheDir, $staleCacheDir);
$fs->expects($this->once())->method('remove')->with(array($staleCacheDir, $this->store->getLocationCacheLockName($locationId), $locationCacheDir));
$request = Request::create('/', 'PURGE');
$request->headers->set('X-Location-Id', "{$locationId}");
$this->store->purgeByRequest($request);
}