Skip to content

Commit 67d7c1f

Browse files
author
Benoit POLASZEK
committed
tests: fix coverage
1 parent 559cdda commit 67d7c1f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Endpoints/DocumentsTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,23 @@ public function testGetDocumentsWithSort(): void
681681
self::assertSame(1344, $response[0]['id']);
682682
}
683683

684+
public function testGetDocumentsWithFiltersFieldsAndSort(): void
685+
{
686+
$index = $this->createEmptyIndex($this->safeIndexName('movies'));
687+
$index->updateSortableAttributes(['id', 'genre']);
688+
$index->updateFilterableAttributes(['id', 'genre']);
689+
$promise = $index->addDocuments(self::DOCUMENTS);
690+
$index->waitForTask($promise['taskUid']);
691+
692+
$query = (new DocumentsQuery())
693+
->setSort(['genre:desc', 'id:asc'])
694+
->setFields(['id', 'title'])
695+
->setFilter(['id > 2']);
696+
$response = $index->getDocuments($query);
697+
self::assertSame(123, $response[0]['id']);
698+
self::assertSame(['id', 'title'], array_keys($response[0]));
699+
}
700+
684701
public function testGetDocumentsWithFilterCorrectFieldFormat(): void
685702
{
686703
$fields = ['the', 'clash'];

0 commit comments

Comments
 (0)