| @@ 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 |
|
| @@ 813-844 (lines=32) @@ | ||
| 810 | /** |
|
| 811 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias |
|
| 812 | */ |
|
| 813 | public function testLoadUrlAliasHasCache() |
|
| 814 | { |
|
| 815 | $this->loggerMock->expects($this->never())->method('logCall'); |
|
| 816 | ||
| 817 | $this->persistenceHandlerMock |
|
| 818 | ->expects($this->never()) |
|
| 819 | ->method($this->anything()); |
|
| 820 | ||
| 821 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 822 | $this->cacheMock |
|
| 823 | ->expects($this->once()) |
|
| 824 | ->method('getItem') |
|
| 825 | ->with('urlAlias', 55) |
|
| 826 | ->will($this->returnValue($cacheItemMock)); |
|
| 827 | ||
| 828 | $cacheItemMock |
|
| 829 | ->expects($this->once()) |
|
| 830 | ->method('get') |
|
| 831 | ->will($this->returnValue(new UrlAlias(array('id' => 55)))); |
|
| 832 | ||
| 833 | $cacheItemMock |
|
| 834 | ->expects($this->once()) |
|
| 835 | ->method('isMiss') |
|
| 836 | ->will($this->returnValue(false)); |
|
| 837 | ||
| 838 | $cacheItemMock |
|
| 839 | ->expects($this->never()) |
|
| 840 | ->method('set'); |
|
| 841 | ||
| 842 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 843 | $handler->loadUrlAlias(55); |
|
| 844 | } |
|
| 845 | ||
| 846 | /** |
|
| 847 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::locationMoved |
|