| @@ 195-229 (lines=35) @@ | ||
| 192 | /** |
|
| 193 | * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroup |
|
| 194 | */ |
|
| 195 | public function testLoadGroupHasCache() |
|
| 196 | { |
|
| 197 | $this->loggerMock->expects($this->never())->method($this->anything()); |
|
| 198 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 199 | $this->cacheMock |
|
| 200 | ->expects($this->once()) |
|
| 201 | ->method('getItem') |
|
| 202 | ->with('contentTypeGroup', 55) |
|
| 203 | ->will($this->returnValue($cacheItemMock)); |
|
| 204 | ||
| 205 | $cacheItemMock |
|
| 206 | ->expects($this->once()) |
|
| 207 | ->method('get') |
|
| 208 | ->will( |
|
| 209 | $this->returnValue( |
|
| 210 | new SPITypeGroup() |
|
| 211 | ) |
|
| 212 | ); |
|
| 213 | ||
| 214 | $cacheItemMock |
|
| 215 | ->expects($this->once()) |
|
| 216 | ->method('isMiss') |
|
| 217 | ->will($this->returnValue(false)); |
|
| 218 | ||
| 219 | $this->persistenceHandlerMock |
|
| 220 | ->expects($this->never()) |
|
| 221 | ->method('contentTypeHandler'); |
|
| 222 | ||
| 223 | $cacheItemMock |
|
| 224 | ->expects($this->never()) |
|
| 225 | ->method('set'); |
|
| 226 | ||
| 227 | $handler = $this->persistenceCacheHandler->contentTypeHandler(); |
|
| 228 | $handler->loadGroup(55); |
|
| 229 | } |
|
| 230 | ||
| 231 | /** |
|
| 232 | * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroupByIdentifier |
|
| @@ 75-105 (lines=31) @@ | ||
| 72 | /** |
|
| 73 | * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::load |
|
| 74 | */ |
|
| 75 | public function testLoadHasCache() |
|
| 76 | { |
|
| 77 | $this->loggerMock->expects($this->never())->method($this->anything()); |
|
| 78 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 79 | $this->cacheMock |
|
| 80 | ->expects($this->once()) |
|
| 81 | ->method('getItem') |
|
| 82 | ->with('location', 33) |
|
| 83 | ->will($this->returnValue($cacheItemMock)); |
|
| 84 | ||
| 85 | $cacheItemMock |
|
| 86 | ->expects($this->once()) |
|
| 87 | ->method('get') |
|
| 88 | ->will($this->returnValue(new Location(array('id' => 33)))); |
|
| 89 | ||
| 90 | $cacheItemMock |
|
| 91 | ->expects($this->once()) |
|
| 92 | ->method('isMiss') |
|
| 93 | ->will($this->returnValue(false)); |
|
| 94 | ||
| 95 | $this->persistenceHandlerMock |
|
| 96 | ->expects($this->never()) |
|
| 97 | ->method('locationHandler'); |
|
| 98 | ||
| 99 | $cacheItemMock |
|
| 100 | ->expects($this->never()) |
|
| 101 | ->method('set'); |
|
| 102 | ||
| 103 | $handler = $this->persistenceCacheHandler->locationHandler(); |
|
| 104 | $handler->load(33); |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::loadLocationsByContent |
|
| @@ 873-904 (lines=32) @@ | ||
| 870 | /** |
|
| 871 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias |
|
| 872 | */ |
|
| 873 | public function testLoadUrlAliasHasCache() |
|
| 874 | { |
|
| 875 | $this->loggerMock->expects($this->never())->method('logCall'); |
|
| 876 | ||
| 877 | $this->persistenceHandlerMock |
|
| 878 | ->expects($this->never()) |
|
| 879 | ->method($this->anything()); |
|
| 880 | ||
| 881 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 882 | $this->cacheMock |
|
| 883 | ->expects($this->once()) |
|
| 884 | ->method('getItem') |
|
| 885 | ->with('urlAlias', 55) |
|
| 886 | ->will($this->returnValue($cacheItemMock)); |
|
| 887 | ||
| 888 | $cacheItemMock |
|
| 889 | ->expects($this->once()) |
|
| 890 | ->method('get') |
|
| 891 | ->will($this->returnValue(new UrlAlias(array('id' => 55)))); |
|
| 892 | ||
| 893 | $cacheItemMock |
|
| 894 | ->expects($this->once()) |
|
| 895 | ->method('isMiss') |
|
| 896 | ->will($this->returnValue(false)); |
|
| 897 | ||
| 898 | $cacheItemMock |
|
| 899 | ->expects($this->never()) |
|
| 900 | ->method('set'); |
|
| 901 | ||
| 902 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 903 | $handler->loadUrlAlias(55); |
|
| 904 | } |
|
| 905 | ||
| 906 | /** |
|
| 907 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::locationMoved |
|
| @@ 252-283 (lines=32) @@ | ||
| 249 | /** |
|
| 250 | * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole |
|
| 251 | */ |
|
| 252 | public function testLoadRoleHasCache() |
|
| 253 | { |
|
| 254 | $this->loggerMock->expects($this->never())->method('logCall'); |
|
| 255 | ||
| 256 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 257 | $this->cacheMock |
|
| 258 | ->expects($this->once()) |
|
| 259 | ->method('getItem') |
|
| 260 | ->with('user', 'role', 33) |
|
| 261 | ->will($this->returnValue($cacheItemMock)); |
|
| 262 | ||
| 263 | $cacheItemMock |
|
| 264 | ->expects($this->once()) |
|
| 265 | ->method('get') |
|
| 266 | ->will($this->returnValue(new Role())); |
|
| 267 | ||
| 268 | $cacheItemMock |
|
| 269 | ->expects($this->once()) |
|
| 270 | ->method('isMiss') |
|
| 271 | ->will($this->returnValue(false)); |
|
| 272 | ||
| 273 | $this->persistenceHandlerMock |
|
| 274 | ->expects($this->never()) |
|
| 275 | ->method($this->anything()); |
|
| 276 | ||
| 277 | $cacheItemMock |
|
| 278 | ->expects($this->never()) |
|
| 279 | ->method('set'); |
|
| 280 | ||
| 281 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 282 | $handler->loadRole(33); |
|
| 283 | } |
|
| 284 | ||
| 285 | /** |
|
| 286 | * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::loadRoleAssignmentsByGroupId |
|