| @@ 191-218 (lines=28) @@ | ||
| 188 | * |
|
| 189 | * @return \eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper |
|
| 190 | */ |
|
| 191 | protected function getLocationMapperMock() |
|
| 192 | { |
|
| 193 | $mapperMock = $this->getMockBuilder(LocationMapper::class) |
|
| 194 | ->setMethods(array('createLocationsFromRows')) |
|
| 195 | ->getMock(); |
|
| 196 | $mapperMock |
|
| 197 | ->expects($this->any()) |
|
| 198 | ->method('createLocationsFromRows') |
|
| 199 | ->with($this->isType('array')) |
|
| 200 | ->will( |
|
| 201 | $this->returnCallback( |
|
| 202 | function ($rows) { |
|
| 203 | $locations = array(); |
|
| 204 | foreach ($rows as $row) { |
|
| 205 | $locationId = (int)$row['node_id']; |
|
| 206 | if (!isset($locations[$locationId])) { |
|
| 207 | $locations[$locationId] = new SPILocation(); |
|
| 208 | $locations[$locationId]->id = $locationId; |
|
| 209 | } |
|
| 210 | } |
|
| 211 | ||
| 212 | return array_values($locations); |
|
| 213 | } |
|
| 214 | ) |
|
| 215 | ); |
|
| 216 | ||
| 217 | return $mapperMock; |
|
| 218 | } |
|
| 219 | ||
| 220 | public function testNoSorting() |
|
| 221 | { |
|
| @@ 255-282 (lines=28) @@ | ||
| 252 | * |
|
| 253 | * @return \eZ\Publish\Core\Persistence\Legacy\Content\Location\Mapper |
|
| 254 | */ |
|
| 255 | protected function getLocationMapperMock() |
|
| 256 | { |
|
| 257 | $mapperMock = $this->getMockBuilder(LocationMapper::class) |
|
| 258 | ->setMethods(array('createLocationsFromRows')) |
|
| 259 | ->getMock(); |
|
| 260 | $mapperMock |
|
| 261 | ->expects($this->any()) |
|
| 262 | ->method('createLocationsFromRows') |
|
| 263 | ->with($this->isType('array')) |
|
| 264 | ->will( |
|
| 265 | $this->returnCallback( |
|
| 266 | function ($rows) { |
|
| 267 | $locations = array(); |
|
| 268 | foreach ($rows as $row) { |
|
| 269 | $locationId = (int)$row['node_id']; |
|
| 270 | if (!isset($locations[$locationId])) { |
|
| 271 | $locations[$locationId] = new SPILocation(); |
|
| 272 | $locations[$locationId]->id = $locationId; |
|
| 273 | } |
|
| 274 | } |
|
| 275 | ||
| 276 | return array_values($locations); |
|
| 277 | } |
|
| 278 | ) |
|
| 279 | ); |
|
| 280 | ||
| 281 | return $mapperMock; |
|
| 282 | } |
|
| 283 | ||
| 284 | public function testFindWithoutOffsetLimit() |
|
| 285 | { |
|