| @@ 155-200 (lines=46) @@ | ||
| 152 | /** |
|
| 153 | * @covers \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroup |
|
| 154 | */ |
|
| 155 | public function testLoadGroupIsMiss() |
|
| 156 | { |
|
| 157 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 158 | $cacheItemMock = $this->getCacheItemMock(); |
|
| 159 | $this->cacheMock |
|
| 160 | ->expects($this->once()) |
|
| 161 | ->method('getItem') |
|
| 162 | ->with('contentTypeGroup', 55) |
|
| 163 | ->will($this->returnValue($cacheItemMock)); |
|
| 164 | ||
| 165 | $cacheItemMock |
|
| 166 | ->expects($this->once()) |
|
| 167 | ->method('get') |
|
| 168 | ->will($this->returnValue(null)); |
|
| 169 | ||
| 170 | $cacheItemMock |
|
| 171 | ->expects($this->once()) |
|
| 172 | ->method('isMiss') |
|
| 173 | ->will($this->returnValue(true)); |
|
| 174 | ||
| 175 | $innerHandler = $this->getContentTypeHandlerMock(); |
|
| 176 | $this->persistenceHandlerMock |
|
| 177 | ->expects($this->once()) |
|
| 178 | ->method('contentTypeHandler') |
|
| 179 | ->will($this->returnValue($innerHandler)); |
|
| 180 | ||
| 181 | $innerHandler |
|
| 182 | ->expects($this->once()) |
|
| 183 | ->method('loadGroup') |
|
| 184 | ->with(55) |
|
| 185 | ->will($this->returnValue(new SPITypeGroup())); |
|
| 186 | ||
| 187 | $cacheItemMock |
|
| 188 | ->expects($this->once()) |
|
| 189 | ->method('set') |
|
| 190 | ->with($this->isInstanceOf(SPITypeGroup::class)) |
|
| 191 | ->will($this->returnValue($cacheItemMock)); |
|
| 192 | ||
| 193 | $cacheItemMock |
|
| 194 | ->expects($this->once()) |
|
| 195 | ->method('save') |
|
| 196 | ->with(); |
|
| 197 | ||
| 198 | $handler = $this->persistenceCacheHandler->contentTypeHandler(); |
|
| 199 | $handler->loadGroup(55); |
|
| 200 | } |
|
| 201 | ||
| 202 | /** |
|
| 203 | * @covers \eZ\Publish\Core\Persistence\Cache\ContentTypeHandler::loadGroup |
|
| @@ 37-82 (lines=46) @@ | ||
| 34 | /** |
|
| 35 | * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::load |
|
| 36 | */ |
|
| 37 | public function testLoadCacheIsMiss() |
|
| 38 | { |
|
| 39 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 40 | $cacheItemMock = $this->getCacheItemMock(); |
|
| 41 | $this->cacheMock |
|
| 42 | ->expects($this->once()) |
|
| 43 | ->method('getItem') |
|
| 44 | ->with('location', 33) |
|
| 45 | ->will($this->returnValue($cacheItemMock)); |
|
| 46 | ||
| 47 | $cacheItemMock |
|
| 48 | ->expects($this->once()) |
|
| 49 | ->method('get') |
|
| 50 | ->will($this->returnValue(null)); |
|
| 51 | ||
| 52 | $cacheItemMock |
|
| 53 | ->expects($this->once()) |
|
| 54 | ->method('isMiss') |
|
| 55 | ->will($this->returnValue(true)); |
|
| 56 | ||
| 57 | $innerHandlerMock = $this->getSPILocationHandlerMock(); |
|
| 58 | $this->persistenceHandlerMock |
|
| 59 | ->expects($this->once()) |
|
| 60 | ->method('locationHandler') |
|
| 61 | ->will($this->returnValue($innerHandlerMock)); |
|
| 62 | ||
| 63 | $innerHandlerMock |
|
| 64 | ->expects($this->once()) |
|
| 65 | ->method('load') |
|
| 66 | ->with(33) |
|
| 67 | ->will($this->returnValue(new Location(['id' => 33]))); |
|
| 68 | ||
| 69 | $cacheItemMock |
|
| 70 | ->expects($this->once()) |
|
| 71 | ->method('set') |
|
| 72 | ->with($this->isInstanceOf(Location::class)) |
|
| 73 | ->will($this->returnValue($cacheItemMock)); |
|
| 74 | ||
| 75 | $cacheItemMock |
|
| 76 | ->expects($this->once()) |
|
| 77 | ->method('save') |
|
| 78 | ->with(); |
|
| 79 | ||
| 80 | $handler = $this->persistenceCacheHandler->locationHandler(); |
|
| 81 | $handler->load(33); |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * @covers \eZ\Publish\Core\Persistence\Cache\LocationHandler::load |
|
| @@ 935-981 (lines=47) @@ | ||
| 932 | /** |
|
| 933 | * @covers \eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias |
|
| 934 | */ |
|
| 935 | public function testLoadUrlAliasIsMiss() |
|
| 936 | { |
|
| 937 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 938 | ||
| 939 | $cacheItemMock = $this->getCacheItemMock(); |
|
| 940 | $this->cacheMock |
|
| 941 | ->expects($this->once()) |
|
| 942 | ->method('getItem') |
|
| 943 | ->with('urlAlias', 55) |
|
| 944 | ->will($this->returnValue($cacheItemMock)); |
|
| 945 | ||
| 946 | $cacheItemMock |
|
| 947 | ->expects($this->once()) |
|
| 948 | ->method('get') |
|
| 949 | ->will($this->returnValue(null)); |
|
| 950 | ||
| 951 | $cacheItemMock |
|
| 952 | ->expects($this->once()) |
|
| 953 | ->method('isMiss') |
|
| 954 | ->will($this->returnValue(true)); |
|
| 955 | ||
| 956 | $innerHandler = $this->getSPIUrlAliasHandlerMock(); |
|
| 957 | $this->persistenceHandlerMock |
|
| 958 | ->expects($this->once()) |
|
| 959 | ->method('urlAliasHandler') |
|
| 960 | ->will($this->returnValue($innerHandler)); |
|
| 961 | ||
| 962 | $innerHandler |
|
| 963 | ->expects($this->once()) |
|
| 964 | ->method('loadUrlAlias') |
|
| 965 | ->with(55) |
|
| 966 | ->will($this->returnValue(new UrlAlias(['id' => 55]))); |
|
| 967 | ||
| 968 | $cacheItemMock |
|
| 969 | ->expects($this->once()) |
|
| 970 | ->method('set') |
|
| 971 | ->with($this->isInstanceOf(UrlAlias::class)) |
|
| 972 | ->will($this->returnValue($cacheItemMock)); |
|
| 973 | ||
| 974 | $cacheItemMock |
|
| 975 | ->expects($this->once()) |
|
| 976 | ->method('save') |
|
| 977 | ->with(); |
|
| 978 | ||
| 979 | $handler = $this->persistenceCacheHandler->urlAliasHandler(); |
|
| 980 | $handler->loadUrlAlias(55); |
|
| 981 | } |
|
| 982 | ||
| 983 | /** |
|
| 984 | * @covers \eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::loadUrlAlias |
|
| @@ 210-258 (lines=49) @@ | ||
| 207 | /** |
|
| 208 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole |
|
| 209 | */ |
|
| 210 | public function testLoadRoleIsMiss() |
|
| 211 | { |
|
| 212 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 213 | ||
| 214 | $cacheItemMock = $this->getCacheItemMock(); |
|
| 215 | $this->cacheMock |
|
| 216 | ->expects($this->once()) |
|
| 217 | ->method('getItem') |
|
| 218 | ->with('user', 'role', 33) |
|
| 219 | ->will($this->returnValue($cacheItemMock)); |
|
| 220 | ||
| 221 | $cacheItemMock |
|
| 222 | ->expects($this->once()) |
|
| 223 | ->method('get') |
|
| 224 | ->will($this->returnValue(null)); |
|
| 225 | ||
| 226 | $cacheItemMock |
|
| 227 | ->expects($this->once()) |
|
| 228 | ->method('isMiss') |
|
| 229 | ->will($this->returnValue(true)); |
|
| 230 | ||
| 231 | $innerHandlerMock = $this->getSPIUserHandlerMock(); |
|
| 232 | $this->persistenceHandlerMock |
|
| 233 | ->expects($this->once()) |
|
| 234 | ->method('userHandler') |
|
| 235 | ->will($this->returnValue($innerHandlerMock)); |
|
| 236 | ||
| 237 | $innerHandlerMock |
|
| 238 | ->expects($this->once()) |
|
| 239 | ->method('loadRole') |
|
| 240 | ->with(33) |
|
| 241 | ->will( |
|
| 242 | $this->returnValue(new Role()) |
|
| 243 | ); |
|
| 244 | ||
| 245 | $cacheItemMock |
|
| 246 | ->expects($this->once()) |
|
| 247 | ->method('set') |
|
| 248 | ->with($this->isInstanceOf(Role::class)) |
|
| 249 | ->will($this->returnValue($cacheItemMock)); |
|
| 250 | ||
| 251 | $cacheItemMock |
|
| 252 | ->expects($this->once()) |
|
| 253 | ->method('save') |
|
| 254 | ->with(); |
|
| 255 | ||
| 256 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 257 | $handler->loadRole(33); |
|
| 258 | } |
|
| 259 | ||
| 260 | /** |
|
| 261 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole |
|