| @@ 503-534 (lines=32) @@ | ||
| 500 | } |
|
| 501 | } |
|
| 502 | ||
| 503 | public function testSortFieldNumeric() |
|
| 504 | { |
|
| 505 | $locator = $this->getContentSearchHandler(); |
|
| 506 | ||
| 507 | $result = $locator->findContent( |
|
| 508 | new Query( |
|
| 509 | array( |
|
| 510 | 'filter' => new Criterion\LogicalAnd( |
|
| 511 | array( |
|
| 512 | new Criterion\SectionId(array(1)), |
|
| 513 | new Criterion\ContentTypeIdentifier('product'), |
|
| 514 | ) |
|
| 515 | ), |
|
| 516 | 'offset' => 0, |
|
| 517 | 'limit' => null, |
|
| 518 | 'sortClauses' => array( |
|
| 519 | new SortClause\Field('product', 'price', Query::SORT_ASC, 'eng-US'), |
|
| 520 | ), |
|
| 521 | ) |
|
| 522 | ) |
|
| 523 | ); |
|
| 524 | ||
| 525 | $this->assertEquals( |
|
| 526 | array(73, 71, 72, 69), |
|
| 527 | array_map( |
|
| 528 | function ($hit) { |
|
| 529 | return $hit->valueObject->id; |
|
| 530 | }, |
|
| 531 | $result->searchHits |
|
| 532 | ) |
|
| 533 | ); |
|
| 534 | } |
|
| 535 | } |
|
| 536 | ||
| @@ 657-688 (lines=32) @@ | ||
| 654 | } |
|
| 655 | } |
|
| 656 | ||
| 657 | public function testSortFieldNumeric() |
|
| 658 | { |
|
| 659 | $handler = $this->getContentSearchHandler(); |
|
| 660 | ||
| 661 | $result = $handler->findLocations( |
|
| 662 | new LocationQuery( |
|
| 663 | array( |
|
| 664 | 'filter' => new Criterion\LogicalAnd( |
|
| 665 | array( |
|
| 666 | new Criterion\SectionId(array(1)), |
|
| 667 | new Criterion\ContentTypeIdentifier('product'), |
|
| 668 | ) |
|
| 669 | ), |
|
| 670 | 'offset' => 0, |
|
| 671 | 'limit' => null, |
|
| 672 | 'sortClauses' => array( |
|
| 673 | new SortClause\Field('product', 'price', LocationQuery::SORT_ASC, 'eng-US'), |
|
| 674 | ), |
|
| 675 | ) |
|
| 676 | ) |
|
| 677 | ); |
|
| 678 | ||
| 679 | $this->assertEquals( |
|
| 680 | array(75, 73, 74, 71), |
|
| 681 | array_map( |
|
| 682 | function ($hit) { |
|
| 683 | return $hit->valueObject->id; |
|
| 684 | }, |
|
| 685 | $result->searchHits |
|
| 686 | ) |
|
| 687 | ); |
|
| 688 | } |
|
| 689 | ||
| 690 | public function testSortIsMainLocationAscending() |
|
| 691 | { |
|