| @@ 294-316 (lines=23) @@ | ||
| 291 | /** |
|
| 292 | * Issue with PHP_MAX_INT limit overflow in databases. |
|
| 293 | */ |
|
| 294 | public function testFindWithNullLimit() |
|
| 295 | { |
|
| 296 | $locator = $this->getContentSearchHandler(); |
|
| 297 | ||
| 298 | $result = $locator->findContent( |
|
| 299 | new Query( |
|
| 300 | [ |
|
| 301 | 'filter' => new Criterion\ContentId(10), |
|
| 302 | 'offset' => 0, |
|
| 303 | 'limit' => null, |
|
| 304 | ] |
|
| 305 | ) |
|
| 306 | ); |
|
| 307 | ||
| 308 | $this->assertEquals( |
|
| 309 | 1, |
|
| 310 | $result->totalCount |
|
| 311 | ); |
|
| 312 | $this->assertEquals( |
|
| 313 | 1, |
|
| 314 | count($result->searchHits) |
|
| 315 | ); |
|
| 316 | } |
|
| 317 | ||
| 318 | /** |
|
| 319 | * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception. |
|
| @@ 321-343 (lines=23) @@ | ||
| 318 | /** |
|
| 319 | * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception. |
|
| 320 | */ |
|
| 321 | public function testFindWithOffsetToNonexistent() |
|
| 322 | { |
|
| 323 | $locator = $this->getContentSearchHandler(); |
|
| 324 | ||
| 325 | $result = $locator->findContent( |
|
| 326 | new Query( |
|
| 327 | [ |
|
| 328 | 'filter' => new Criterion\ContentId(10), |
|
| 329 | 'offset' => 1000, |
|
| 330 | 'limit' => null, |
|
| 331 | ] |
|
| 332 | ) |
|
| 333 | ); |
|
| 334 | ||
| 335 | $this->assertEquals( |
|
| 336 | 1, |
|
| 337 | $result->totalCount |
|
| 338 | ); |
|
| 339 | $this->assertEquals( |
|
| 340 | 0, |
|
| 341 | count($result->searchHits) |
|
| 342 | ); |
|
| 343 | } |
|
| 344 | ||
| 345 | public function testFindSingle() |
|
| 346 | { |
|
| @@ 1018-1048 (lines=31) @@ | ||
| 1015 | ); |
|
| 1016 | } |
|
| 1017 | ||
| 1018 | public function testFullTextFilterNoStopwordRemoval() |
|
| 1019 | { |
|
| 1020 | $handler = $this->getContentSearchHandler( |
|
| 1021 | [ |
|
| 1022 | 'stopWordThresholdFactor' => 1, |
|
| 1023 | ] |
|
| 1024 | ); |
|
| 1025 | ||
| 1026 | $result = $handler->findContent( |
|
| 1027 | new Query( |
|
| 1028 | [ |
|
| 1029 | 'filter' => new Criterion\FullText( |
|
| 1030 | 'the' |
|
| 1031 | ), |
|
| 1032 | 'limit' => 10, |
|
| 1033 | ] |
|
| 1034 | ) |
|
| 1035 | ); |
|
| 1036 | ||
| 1037 | $this->assertEquals( |
|
| 1038 | 10, |
|
| 1039 | count( |
|
| 1040 | array_map( |
|
| 1041 | function ($hit) { |
|
| 1042 | return $hit->valueObject->id; |
|
| 1043 | }, |
|
| 1044 | $result->searchHits |
|
| 1045 | ) |
|
| 1046 | ) |
|
| 1047 | ); |
|
| 1048 | } |
|
| 1049 | ||
| 1050 | /** |
|
| 1051 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|