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