| @@ 167-205 (lines=39) @@ | ||
| 164 | /** |
|
| 165 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::delete |
|
| 166 | */ |
|
| 167 | public function testDelete() |
|
| 168 | { |
|
| 169 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 170 | ||
| 171 | $innerHandlerMock = $this->getSPIUserHandlerMock(); |
|
| 172 | $this->persistenceHandlerMock |
|
| 173 | ->expects($this->once()) |
|
| 174 | ->method('userHandler') |
|
| 175 | ->will($this->returnValue($innerHandlerMock)); |
|
| 176 | ||
| 177 | $innerHandlerMock |
|
| 178 | ->expects($this->once()) |
|
| 179 | ->method('delete') |
|
| 180 | ->with(14) |
|
| 181 | ->will( |
|
| 182 | $this->returnValue(true) |
|
| 183 | ); |
|
| 184 | ||
| 185 | $this->cacheMock |
|
| 186 | ->expects($this->at(0)) |
|
| 187 | ->method('clear') |
|
| 188 | ->with('content', 14) |
|
| 189 | ->will($this->returnValue(true)); |
|
| 190 | ||
| 191 | $this->cacheMock |
|
| 192 | ->expects($this->at(1)) |
|
| 193 | ->method('clear') |
|
| 194 | ->with('user', 'role', 'assignments', 'byGroup', 14) |
|
| 195 | ->will($this->returnValue(true)); |
|
| 196 | ||
| 197 | $this->cacheMock |
|
| 198 | ->expects($this->at(2)) |
|
| 199 | ->method('clear') |
|
| 200 | ->with('user', 'role', 'assignments', 'byGroup', 'inherited', 14) |
|
| 201 | ->will($this->returnValue(true)); |
|
| 202 | ||
| 203 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 204 | $handler->delete(14); |
|
| 205 | } |
|
| 206 | ||
| 207 | /** |
|
| 208 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::loadRole |
|
| @@ 956-994 (lines=39) @@ | ||
| 953 | /** |
|
| 954 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::assignRole |
|
| 955 | */ |
|
| 956 | public function testAssignRole() |
|
| 957 | { |
|
| 958 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 959 | ||
| 960 | $innerHandlerMock = $this->getSPIUserHandlerMock(); |
|
| 961 | $this->persistenceHandlerMock |
|
| 962 | ->expects($this->once()) |
|
| 963 | ->method('userHandler') |
|
| 964 | ->will($this->returnValue($innerHandlerMock)); |
|
| 965 | ||
| 966 | $innerHandlerMock |
|
| 967 | ->expects($this->once()) |
|
| 968 | ->method('assignRole') |
|
| 969 | ->with(33, 22) |
|
| 970 | ->will( |
|
| 971 | $this->returnValue(true) |
|
| 972 | ); |
|
| 973 | ||
| 974 | $this->cacheMock |
|
| 975 | ->expects($this->at(0)) |
|
| 976 | ->method('clear') |
|
| 977 | ->with('user', 'role', 22) |
|
| 978 | ->will($this->returnValue(true)); |
|
| 979 | ||
| 980 | $this->cacheMock |
|
| 981 | ->expects($this->at(1)) |
|
| 982 | ->method('clear') |
|
| 983 | ->with('user', 'role', 'assignments', 'byGroup', 33) |
|
| 984 | ->will($this->returnValue(true)); |
|
| 985 | ||
| 986 | $this->cacheMock |
|
| 987 | ->expects($this->at(2)) |
|
| 988 | ->method('clear') |
|
| 989 | ->with('user', 'role', 'assignments', 'byGroup', 'inherited') |
|
| 990 | ->will($this->returnValue(true)); |
|
| 991 | ||
| 992 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 993 | $handler->assignRole(33, 22); |
|
| 994 | } |
|
| 995 | ||
| 996 | /** |
|
| 997 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::unassignRole |
|
| @@ 999-1037 (lines=39) @@ | ||
| 996 | /** |
|
| 997 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::unassignRole |
|
| 998 | */ |
|
| 999 | public function testUnassignRole() |
|
| 1000 | { |
|
| 1001 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 1002 | ||
| 1003 | $innerHandlerMock = $this->getSPIUserHandlerMock(); |
|
| 1004 | $this->persistenceHandlerMock |
|
| 1005 | ->expects($this->once()) |
|
| 1006 | ->method('userHandler') |
|
| 1007 | ->will($this->returnValue($innerHandlerMock)); |
|
| 1008 | ||
| 1009 | $innerHandlerMock |
|
| 1010 | ->expects($this->once()) |
|
| 1011 | ->method('unassignRole') |
|
| 1012 | ->with(33, 22) |
|
| 1013 | ->will( |
|
| 1014 | $this->returnValue(true) |
|
| 1015 | ); |
|
| 1016 | ||
| 1017 | $this->cacheMock |
|
| 1018 | ->expects($this->at(0)) |
|
| 1019 | ->method('clear') |
|
| 1020 | ->with('user', 'role', 22) |
|
| 1021 | ->will($this->returnValue(true)); |
|
| 1022 | ||
| 1023 | $this->cacheMock |
|
| 1024 | ->expects($this->at(1)) |
|
| 1025 | ->method('clear') |
|
| 1026 | ->with('user', 'role', 'assignments', 'byGroup', 33) |
|
| 1027 | ->will($this->returnValue(true)); |
|
| 1028 | ||
| 1029 | $this->cacheMock |
|
| 1030 | ->expects($this->at(2)) |
|
| 1031 | ->method('clear') |
|
| 1032 | ->with('user', 'role', 'assignments', 'byGroup', 'inherited') |
|
| 1033 | ->will($this->returnValue(true)); |
|
| 1034 | ||
| 1035 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 1036 | $handler->unassignRole(33, 22); |
|
| 1037 | } |
|
| 1038 | } |
|
| 1039 | ||