| @@ 133-172 (lines=40) @@ | ||
| 130 | /** |
|
| 131 | * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroup |
|
| 132 | */ |
|
| 133 | public function testLoadGroupIsMiss() |
|
| 134 | { |
|
| 135 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 136 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 137 | $this->cacheMock |
|
| 138 | ->expects($this->once()) |
|
| 139 | ->method('getItem') |
|
| 140 | ->with('contentTypeGroup', 55) |
|
| 141 | ->will($this->returnValue($cacheItemMock)); |
|
| 142 | ||
| 143 | $cacheItemMock |
|
| 144 | ->expects($this->once()) |
|
| 145 | ->method('get') |
|
| 146 | ->will($this->returnValue(null)); |
|
| 147 | ||
| 148 | $cacheItemMock |
|
| 149 | ->expects($this->once()) |
|
| 150 | ->method('isMiss') |
|
| 151 | ->will($this->returnValue(true)); |
|
| 152 | ||
| 153 | $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\Handler'); |
|
| 154 | $this->persistenceHandlerMock |
|
| 155 | ->expects($this->once()) |
|
| 156 | ->method('contentTypeHandler') |
|
| 157 | ->will($this->returnValue($innerHandler)); |
|
| 158 | ||
| 159 | $innerHandler |
|
| 160 | ->expects($this->once()) |
|
| 161 | ->method('loadGroup') |
|
| 162 | ->with(55) |
|
| 163 | ->will($this->returnValue(new SPITypeGroup())); |
|
| 164 | ||
| 165 | $cacheItemMock |
|
| 166 | ->expects($this->once()) |
|
| 167 | ->method('set') |
|
| 168 | ->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\Group')); |
|
| 169 | ||
| 170 | $handler = $this->persistenceCacheHandler->contentTypeHandler(); |
|
| 171 | $handler->loadGroup(55); |
|
| 172 | } |
|
| 173 | ||
| 174 | /** |
|
| 175 | * @covers eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroup |
|
| @@ 25-64 (lines=40) @@ | ||
| 22 | /** |
|
| 23 | * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::load |
|
| 24 | */ |
|
| 25 | public function testLoadCacheIsMiss() |
|
| 26 | { |
|
| 27 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 28 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 29 | $this->cacheMock |
|
| 30 | ->expects($this->once()) |
|
| 31 | ->method('getItem') |
|
| 32 | ->with('location', 33) |
|
| 33 | ->will($this->returnValue($cacheItemMock)); |
|
| 34 | ||
| 35 | $cacheItemMock |
|
| 36 | ->expects($this->once()) |
|
| 37 | ->method('get') |
|
| 38 | ->will($this->returnValue(null)); |
|
| 39 | ||
| 40 | $cacheItemMock |
|
| 41 | ->expects($this->once()) |
|
| 42 | ->method('isMiss') |
|
| 43 | ->will($this->returnValue(true)); |
|
| 44 | ||
| 45 | $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Handler'); |
|
| 46 | $this->persistenceHandlerMock |
|
| 47 | ->expects($this->once()) |
|
| 48 | ->method('locationHandler') |
|
| 49 | ->will($this->returnValue($innerHandlerMock)); |
|
| 50 | ||
| 51 | $innerHandlerMock |
|
| 52 | ->expects($this->once()) |
|
| 53 | ->method('load') |
|
| 54 | ->with(33) |
|
| 55 | ->will($this->returnValue(new Location(array('id' => 33)))); |
|
| 56 | ||
| 57 | $cacheItemMock |
|
| 58 | ->expects($this->once()) |
|
| 59 | ->method('set') |
|
| 60 | ->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Location')); |
|
| 61 | ||
| 62 | $handler = $this->persistenceCacheHandler->locationHandler(); |
|
| 63 | $handler->load(33); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @covers eZ\Publish\Core\Persistence\Cache\LocationHandler::load |
|
| @@ 199-241 (lines=43) @@ | ||
| 196 | /** |
|
| 197 | * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole |
|
| 198 | */ |
|
| 199 | public function testLoadRoleIsMiss() |
|
| 200 | { |
|
| 201 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 202 | ||
| 203 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 204 | $this->cacheMock |
|
| 205 | ->expects($this->once()) |
|
| 206 | ->method('getItem') |
|
| 207 | ->with('user', 'role', 33) |
|
| 208 | ->will($this->returnValue($cacheItemMock)); |
|
| 209 | ||
| 210 | $cacheItemMock |
|
| 211 | ->expects($this->once()) |
|
| 212 | ->method('get') |
|
| 213 | ->will($this->returnValue(null)); |
|
| 214 | ||
| 215 | $cacheItemMock |
|
| 216 | ->expects($this->once()) |
|
| 217 | ->method('isMiss') |
|
| 218 | ->will($this->returnValue(true)); |
|
| 219 | ||
| 220 | $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\User\\Handler'); |
|
| 221 | $this->persistenceHandlerMock |
|
| 222 | ->expects($this->once()) |
|
| 223 | ->method('userHandler') |
|
| 224 | ->will($this->returnValue($innerHandlerMock)); |
|
| 225 | ||
| 226 | $innerHandlerMock |
|
| 227 | ->expects($this->once()) |
|
| 228 | ->method('loadRole') |
|
| 229 | ->with(33) |
|
| 230 | ->will( |
|
| 231 | $this->returnValue(new Role()) |
|
| 232 | ); |
|
| 233 | ||
| 234 | $cacheItemMock |
|
| 235 | ->expects($this->once()) |
|
| 236 | ->method('set') |
|
| 237 | ->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\User\\Role')); |
|
| 238 | ||
| 239 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 240 | $handler->loadRole(33); |
|
| 241 | } |
|
| 242 | ||
| 243 | /** |
|
| 244 | * @covers eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole |
|
| @@ 768-808 (lines=41) @@ | ||
| 765 | /** |
|
| 766 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias |
|
| 767 | */ |
|
| 768 | public function testLoadUrlAliasIsMiss() |
|
| 769 | { |
|
| 770 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 771 | ||
| 772 | $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface'); |
|
| 773 | $this->cacheMock |
|
| 774 | ->expects($this->once()) |
|
| 775 | ->method('getItem') |
|
| 776 | ->with('urlAlias', 55) |
|
| 777 | ->will($this->returnValue($cacheItemMock)); |
|
| 778 | ||
| 779 | $cacheItemMock |
|
| 780 | ->expects($this->once()) |
|
| 781 | ->method('get') |
|
| 782 | ->will($this->returnValue(null)); |
|
| 783 | ||
| 784 | $cacheItemMock |
|
| 785 | ->expects($this->once()) |
|
| 786 | ->method('isMiss') |
|
| 787 | ->will($this->returnValue(true)); |
|
| 788 | ||
| 789 | $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias\\Handler'); |
|
| 790 | $this->persistenceHandlerMock |
|
| 791 | ->expects($this->once()) |
|
| 792 | ->method('urlAliasHandler') |
|
| 793 | ->will($this->returnValue($innerHandler)); |
|
| 794 | ||
| 795 | $innerHandler |
|
| 796 | ->expects($this->once()) |
|
| 797 | ->method('loadUrlAlias') |
|
| 798 | ->with(55) |
|
| 799 | ->will($this->returnValue(new UrlAlias(array('id' => 55)))); |
|
| 800 | ||
| 801 | $cacheItemMock |
|
| 802 | ->expects($this->once()) |
|
| 803 | ->method('set') |
|
| 804 | ->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias')); |
|
| 805 | ||
| 806 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 807 | $handler->loadUrlAlias(55); |
|
| 808 | } |
|
| 809 | ||
| 810 | /** |
|
| 811 | * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias |
|