| @@ 333-351 (lines=19) @@ | ||
| 330 | $expectedGroups = array_slice($testGroups, $offset, $limit > -1 ?: null); |
|
| 331 | ||
| 332 | // loadGroup() |
|
| 333 | foreach ($expectedGroups as $i => $group) { |
|
| 334 | $this->cacheMock |
|
| 335 | ->expects($this->at($i + 1)) |
|
| 336 | ->method('getItem') |
|
| 337 | ->with('objectstategroup', $group->id) |
|
| 338 | ->will( |
|
| 339 | $this->returnCallback( |
|
| 340 | function ($cachekey, $i) use ($group) { |
|
| 341 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 342 | $cacheItemMock |
|
| 343 | ->expects($this->once()) |
|
| 344 | ->method('get') |
|
| 345 | ->will($this->returnValue($group)); |
|
| 346 | ||
| 347 | return $cacheItemMock; |
|
| 348 | } |
|
| 349 | ) |
|
| 350 | ); |
|
| 351 | } |
|
| 352 | ||
| 353 | $handler = $this->persistenceCacheHandler->objectStateHandler(); |
|
| 354 | $groups = $handler->loadAllGroups($offset, $limit); |
|
| @@ 505-523 (lines=19) @@ | ||
| 502 | ->will($this->returnValue(false)); |
|
| 503 | ||
| 504 | // load() |
|
| 505 | foreach ($testStates as $i => $state) { |
|
| 506 | $this->cacheMock |
|
| 507 | ->expects($this->at($i + 1)) |
|
| 508 | ->method('getItem') |
|
| 509 | ->with('objectstate', $state->id) |
|
| 510 | ->will( |
|
| 511 | $this->returnCallback( |
|
| 512 | function ($cachekey, $i) use ($state) { |
|
| 513 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 514 | $cacheItemMock |
|
| 515 | ->expects($this->once()) |
|
| 516 | ->method('get') |
|
| 517 | ->will($this->returnValue($state)); |
|
| 518 | ||
| 519 | return $cacheItemMock; |
|
| 520 | } |
|
| 521 | ) |
|
| 522 | ); |
|
| 523 | } |
|
| 524 | ||
| 525 | $handler = $this->persistenceCacheHandler->objectStateHandler(); |
|
| 526 | $states = $handler->loadObjectStates(1); |
|