| @@ 352-374 (lines=23) @@ | ||
| 349 | /** |
|
| 350 | * Bug #81, bug #82. |
|
| 351 | */ |
|
| 352 | public function testFindWithZeroLimit() |
|
| 353 | { |
|
| 354 | $locator = $this->getContentSearchHandler(); |
|
| 355 | ||
| 356 | $result = $locator->findContent( |
|
| 357 | new Query( |
|
| 358 | [ |
|
| 359 | 'filter' => new Criterion\ContentId(10), |
|
| 360 | 'offset' => 0, |
|
| 361 | 'limit' => 0, |
|
| 362 | ] |
|
| 363 | ) |
|
| 364 | ); |
|
| 365 | ||
| 366 | $this->assertEquals( |
|
| 367 | 1, |
|
| 368 | $result->totalCount |
|
| 369 | ); |
|
| 370 | $this->assertEquals( |
|
| 371 | [], |
|
| 372 | $result->searchHits |
|
| 373 | ); |
|
| 374 | } |
|
| 375 | ||
| 376 | /** |
|
| 377 | * Issue with PHP_MAX_INT limit overflow in databases. |
|
| @@ 300-316 (lines=17) @@ | ||
| 297 | $this->assertCount(1, $searchResult->searchHits); |
|
| 298 | } |
|
| 299 | ||
| 300 | public function testFindWithZeroLimit() |
|
| 301 | { |
|
| 302 | $handler = $this->getContentSearchHandler(); |
|
| 303 | ||
| 304 | $searchResult = $handler->findLocations( |
|
| 305 | new LocationQuery( |
|
| 306 | [ |
|
| 307 | 'filter' => new Criterion\LocationId(2), |
|
| 308 | 'offset' => 0, |
|
| 309 | 'limit' => 0, |
|
| 310 | ] |
|
| 311 | ) |
|
| 312 | ); |
|
| 313 | ||
| 314 | $this->assertEquals(1, $searchResult->totalCount); |
|
| 315 | $this->assertEquals([], $searchResult->searchHits); |
|
| 316 | } |
|
| 317 | ||
| 318 | /** |
|
| 319 | * Issue with PHP_MAX_INT limit overflow in databases. |
|
| @@ 321-337 (lines=17) @@ | ||
| 318 | /** |
|
| 319 | * Issue with PHP_MAX_INT limit overflow in databases. |
|
| 320 | */ |
|
| 321 | public function testFindWithNullLimit() |
|
| 322 | { |
|
| 323 | $handler = $this->getContentSearchHandler(); |
|
| 324 | ||
| 325 | $searchResult = $handler->findLocations( |
|
| 326 | new LocationQuery( |
|
| 327 | [ |
|
| 328 | 'filter' => new Criterion\LocationId(2), |
|
| 329 | 'offset' => 0, |
|
| 330 | 'limit' => null, |
|
| 331 | ] |
|
| 332 | ) |
|
| 333 | ); |
|
| 334 | ||
| 335 | $this->assertEquals(1, $searchResult->totalCount); |
|
| 336 | $this->assertCount(1, $searchResult->searchHits); |
|
| 337 | } |
|
| 338 | ||
| 339 | /** |
|
| 340 | * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception. |
|
| @@ 342-358 (lines=17) @@ | ||
| 339 | /** |
|
| 340 | * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception. |
|
| 341 | */ |
|
| 342 | public function testFindWithOffsetToNonexistent() |
|
| 343 | { |
|
| 344 | $handler = $this->getContentSearchHandler(); |
|
| 345 | ||
| 346 | $searchResult = $handler->findLocations( |
|
| 347 | new LocationQuery( |
|
| 348 | [ |
|
| 349 | 'filter' => new Criterion\LocationId(2), |
|
| 350 | 'offset' => 1000, |
|
| 351 | 'limit' => null, |
|
| 352 | ] |
|
| 353 | ) |
|
| 354 | ); |
|
| 355 | ||
| 356 | $this->assertEquals(1, $searchResult->totalCount); |
|
| 357 | $this->assertEquals([], $searchResult->searchHits); |
|
| 358 | } |
|
| 359 | ||
| 360 | public function testLocationIdFilter() |
|
| 361 | { |
|