| @@ 105-131 (lines=27) @@ | ||
| 102 | /** |
|
| 103 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::create |
|
| 104 | */ |
|
| 105 | public function testCreate() |
|
| 106 | { |
|
| 107 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 108 | ||
| 109 | $innerHandlerMock = $this->getSPIUserHandlerMock(); |
|
| 110 | $this->persistenceHandlerMock |
|
| 111 | ->expects($this->once()) |
|
| 112 | ->method('userHandler') |
|
| 113 | ->will($this->returnValue($innerHandlerMock)); |
|
| 114 | ||
| 115 | $innerHandlerMock |
|
| 116 | ->expects($this->once()) |
|
| 117 | ->method('create') |
|
| 118 | ->with($this->isInstanceOf(User::class)) |
|
| 119 | ->will( |
|
| 120 | $this->returnValue(true) |
|
| 121 | ); |
|
| 122 | ||
| 123 | $this->cacheMock |
|
| 124 | ->expects($this->at(0)) |
|
| 125 | ->method('clear') |
|
| 126 | ->with('content', 42) |
|
| 127 | ->will($this->returnValue(true)); |
|
| 128 | ||
| 129 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 130 | $handler->create(new User(array('id' => 42))); |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::update |
|
| @@ 136-162 (lines=27) @@ | ||
| 133 | /** |
|
| 134 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::update |
|
| 135 | */ |
|
| 136 | public function testUpdate() |
|
| 137 | { |
|
| 138 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 139 | ||
| 140 | $innerHandlerMock = $this->getSPIUserHandlerMock(); |
|
| 141 | $this->persistenceHandlerMock |
|
| 142 | ->expects($this->once()) |
|
| 143 | ->method('userHandler') |
|
| 144 | ->will($this->returnValue($innerHandlerMock)); |
|
| 145 | ||
| 146 | $innerHandlerMock |
|
| 147 | ->expects($this->once()) |
|
| 148 | ->method('update') |
|
| 149 | ->with($this->isInstanceOf(User::class)) |
|
| 150 | ->will( |
|
| 151 | $this->returnValue(true) |
|
| 152 | ); |
|
| 153 | ||
| 154 | $this->cacheMock |
|
| 155 | ->expects($this->at(0)) |
|
| 156 | ->method('clear') |
|
| 157 | ->with('content', 42) |
|
| 158 | ->will($this->returnValue(true)); |
|
| 159 | ||
| 160 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 161 | $handler->update(new User(array('id' => 42))); |
|
| 162 | } |
|
| 163 | ||
| 164 | /** |
|
| 165 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::delete |
|
| @@ 894-920 (lines=27) @@ | ||
| 891 | /** |
|
| 892 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::updatePolicy |
|
| 893 | */ |
|
| 894 | public function testUpdatePolicy() |
|
| 895 | { |
|
| 896 | $this->loggerMock->expects($this->once())->method('logCall'); |
|
| 897 | ||
| 898 | $innerHandlerMock = $this->getSPIUserHandlerMock(); |
|
| 899 | $this->persistenceHandlerMock |
|
| 900 | ->expects($this->once()) |
|
| 901 | ->method('userHandler') |
|
| 902 | ->will($this->returnValue($innerHandlerMock)); |
|
| 903 | ||
| 904 | $innerHandlerMock |
|
| 905 | ->expects($this->once()) |
|
| 906 | ->method('updatePolicy') |
|
| 907 | ->with($this->isInstanceOf(Policy::class)) |
|
| 908 | ->will( |
|
| 909 | $this->returnValue(new Policy(array('roleId' => 33))) |
|
| 910 | ); |
|
| 911 | ||
| 912 | $this->cacheMock |
|
| 913 | ->expects($this->once()) |
|
| 914 | ->method('clear') |
|
| 915 | ->with('user', 'role', 33) |
|
| 916 | ->will($this->returnValue(true)); |
|
| 917 | ||
| 918 | $handler = $this->persistenceCacheHandler->userHandler(); |
|
| 919 | $handler->updatePolicy(new Policy(array('roleId' => 33))); |
|
| 920 | } |
|
| 921 | ||
| 922 | /** |
|
| 923 | * @covers \eZ\Publish\Core\Persistence\Cache\UserHandler::deletePolicy |
|