| @@ 187-215 (lines=29) @@ | ||
| 184 | $this->store->purgeAllContent(); |
|
| 185 | } |
|
| 186 | ||
| 187 | public function testPurgeAllContentByRequest() |
|
| 188 | { |
|
| 189 | $fs = $this->getFilesystemMock(); |
|
| 190 | $this->store->setFilesystem($fs); |
|
| 191 | $locationCacheDir = $this->store->getLocationCacheDir(); |
|
| 192 | $staleCacheDir = str_replace(LocationAwareStore::LOCATION_CACHE_DIR, LocationAwareStore::LOCATION_STALE_CACHE_DIR, $locationCacheDir); |
|
| 193 | ||
| 194 | $fs |
|
| 195 | ->expects($this->any()) |
|
| 196 | ->method('exists') |
|
| 197 | ->with($locationCacheDir) |
|
| 198 | ->will($this->returnValue(true)); |
|
| 199 | $fs |
|
| 200 | ->expects($this->once()) |
|
| 201 | ->method('mkdir') |
|
| 202 | ->with($staleCacheDir); |
|
| 203 | $fs |
|
| 204 | ->expects($this->once()) |
|
| 205 | ->method('mirror') |
|
| 206 | ->with($locationCacheDir, $staleCacheDir); |
|
| 207 | $fs |
|
| 208 | ->expects($this->once()) |
|
| 209 | ->method('remove') |
|
| 210 | ->with(array($staleCacheDir, $this->store->getLocationCacheLockName(), $locationCacheDir)); |
|
| 211 | ||
| 212 | $request = Request::create('/', 'BAN'); |
|
| 213 | $request->headers->set('X-Location-Id', '.*'); |
|
| 214 | $this->store->purgeByRequest($request); |
|
| 215 | } |
|
| 216 | ||
| 217 | public function testPurgeAllContentByRequestBC() |
|
| 218 | { |
|
| @@ 217-245 (lines=29) @@ | ||
| 214 | $this->store->purgeByRequest($request); |
|
| 215 | } |
|
| 216 | ||
| 217 | public function testPurgeAllContentByRequestBC() |
|
| 218 | { |
|
| 219 | $fs = $this->getFilesystemMock(); |
|
| 220 | $this->store->setFilesystem($fs); |
|
| 221 | $locationCacheDir = $this->store->getLocationCacheDir(); |
|
| 222 | $staleCacheDir = str_replace(LocationAwareStore::LOCATION_CACHE_DIR, LocationAwareStore::LOCATION_STALE_CACHE_DIR, $locationCacheDir); |
|
| 223 | ||
| 224 | $fs |
|
| 225 | ->expects($this->any()) |
|
| 226 | ->method('exists') |
|
| 227 | ->with($locationCacheDir) |
|
| 228 | ->will($this->returnValue(true)); |
|
| 229 | $fs |
|
| 230 | ->expects($this->once()) |
|
| 231 | ->method('mkdir') |
|
| 232 | ->with($staleCacheDir); |
|
| 233 | $fs |
|
| 234 | ->expects($this->once()) |
|
| 235 | ->method('mirror') |
|
| 236 | ->with($locationCacheDir, $staleCacheDir); |
|
| 237 | $fs |
|
| 238 | ->expects($this->once()) |
|
| 239 | ->method('remove') |
|
| 240 | ->with(array($staleCacheDir, $this->store->getLocationCacheLockName(), $locationCacheDir)); |
|
| 241 | ||
| 242 | $request = Request::create('/', 'PURGE'); |
|
| 243 | $request->headers->set('X-Location-Id', '*'); |
|
| 244 | $this->store->purgeByRequest($request); |
|
| 245 | } |
|
| 246 | } |
|
| 247 | ||