| @@ 177-211 (lines=35) @@ | ||
| 174 | /** |
|
| 175 | * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroup |
|
| 176 | */ |
|
| 177 | public function testLoadGroupHasCache() |
|
| 178 | { |
|
| 179 | $this->loggerMock->expects($this->never())->method($this->anything()); |
|
| 180 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 181 | $this->cacheMock |
|
| 182 | ->expects($this->once()) |
|
| 183 | ->method('getItem') |
|
| 184 | ->with('contentTypeGroup', 55) |
|
| 185 | ->will($this->returnValue($cacheItemMock)); |
|
| 186 | ||
| 187 | $cacheItemMock |
|
| 188 | ->expects($this->once()) |
|
| 189 | ->method('get') |
|
| 190 | ->will( |
|
| 191 | $this->returnValue( |
|
| 192 | new SPITypeGroup() |
|
| 193 | ) |
|
| 194 | ); |
|
| 195 | ||
| 196 | $cacheItemMock |
|
| 197 | ->expects($this->once()) |
|
| 198 | ->method('isMiss') |
|
| 199 | ->will($this->returnValue(false)); |
|
| 200 | ||
| 201 | $this->persistenceHandlerMock |
|
| 202 | ->expects($this->never()) |
|
| 203 | ->method('contentTypeHandler'); |
|
| 204 | ||
| 205 | $cacheItemMock |
|
| 206 | ->expects($this->never()) |
|
| 207 | ->method('set'); |
|
| 208 | ||
| 209 | $handler = $this->persistenceCacheHandler->contentTypeHandler(); |
|
| 210 | $handler->loadGroup(55); |
|
| 211 | } |
|
| 212 | ||
| 213 | /** |
|
| 214 | * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroupByIdentifier |
|
| @@ 69-99 (lines=31) @@ | ||
| 66 | /** |
|
| 67 | * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::load |
|
| 68 | */ |
|
| 69 | public function testLoadHasCache() |
|
| 70 | { |
|
| 71 | $this->loggerMock->expects($this->never())->method($this->anything()); |
|
| 72 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 73 | $this->cacheMock |
|
| 74 | ->expects($this->once()) |
|
| 75 | ->method('getItem') |
|
| 76 | ->with('location', 33) |
|
| 77 | ->will($this->returnValue($cacheItemMock)); |
|
| 78 | ||
| 79 | $cacheItemMock |
|
| 80 | ->expects($this->once()) |
|
| 81 | ->method('get') |
|
| 82 | ->will($this->returnValue(new Location(array('id' => 33)))); |
|
| 83 | ||
| 84 | $cacheItemMock |
|
| 85 | ->expects($this->once()) |
|
| 86 | ->method('isMiss') |
|
| 87 | ->will($this->returnValue(false)); |
|
| 88 | ||
| 89 | $this->persistenceHandlerMock |
|
| 90 | ->expects($this->never()) |
|
| 91 | ->method('locationHandler'); |
|
| 92 | ||
| 93 | $cacheItemMock |
|
| 94 | ->expects($this->never()) |
|
| 95 | ->method('set'); |
|
| 96 | ||
| 97 | $handler = $this->persistenceCacheHandler->locationHandler(); |
|
| 98 | $handler->load(33); |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::loadLocationsByContent |
|
| @@ 246-277 (lines=32) @@ | ||
| 243 | /** |
|
| 244 | * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole |
|
| 245 | */ |
|
| 246 | public function testLoadRoleHasCache() |
|
| 247 | { |
|
| 248 | $this->loggerMock->expects($this->never())->method('logCall'); |
|
| 249 | ||
| 250 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 251 | $this->cacheMock |
|
| 252 | ->expects($this->once()) |
|
| 253 | ->method('getItem') |
|
| 254 | ->with('user', 'role', 33) |
|
| 255 | ->will($this->returnValue($cacheItemMock)); |
|
| 256 | ||
| 257 | $cacheItemMock |
|
| 258 | ->expects($this->once()) |
|
| 259 | ->method('get') |
|
| 260 | ->will($this->returnValue(new Role())); |
|
| 261 | ||
| 262 | $cacheItemMock |
|
| 263 | ->expects($this->once()) |
|
| 264 | ->method('isMiss') |
|
| 265 | ->will($this->returnValue(false)); |
|
| 266 | ||
| 267 | $this->persistenceHandlerMock |
|
| 268 | ->expects($this->never()) |
|
| 269 | ->method($this->anything()); |
|
| 270 | ||
| 271 | $cacheItemMock |
|
| 272 | ->expects($this->never()) |
|
| 273 | ->method('set'); |
|
| 274 | ||
| 275 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 276 | $handler->loadRole(33); |
|
| 277 | } |
|
| 278 | ||
| 279 | /** |
|
| 280 | * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::loadRoleAssignmentsByGroupId |
|
| @@ 752-783 (lines=32) @@ | ||
| 749 | /** |
|
| 750 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias |
|
| 751 | */ |
|
| 752 | public function testLoadUrlAliasHasCache() |
|
| 753 | { |
|
| 754 | $this->loggerMock->expects($this->never())->method('logCall'); |
|
| 755 | ||
| 756 | $this->persistenceHandlerMock |
|
| 757 | ->expects($this->never()) |
|
| 758 | ->method($this->anything()); |
|
| 759 | ||
| 760 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 761 | $this->cacheMock |
|
| 762 | ->expects($this->once()) |
|
| 763 | ->method('getItem') |
|
| 764 | ->with('urlAlias', 55) |
|
| 765 | ->will($this->returnValue($cacheItemMock)); |
|
| 766 | ||
| 767 | $cacheItemMock |
|
| 768 | ->expects($this->once()) |
|
| 769 | ->method('get') |
|
| 770 | ->will($this->returnValue(new UrlAlias(array('id' => 55)))); |
|
| 771 | ||
| 772 | $cacheItemMock |
|
| 773 | ->expects($this->once()) |
|
| 774 | ->method('isMiss') |
|
| 775 | ->will($this->returnValue(false)); |
|
| 776 | ||
| 777 | $cacheItemMock |
|
| 778 | ->expects($this->never()) |
|
| 779 | ->method('set'); |
|
| 780 | ||
| 781 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 782 | $handler->loadUrlAlias(55); |
|
| 783 | } |
|
| 784 | ||
| 785 | /** |
|
| 786 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::locationMoved |
|