Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Size property for SuggestCriteria (#37)
Browse files Browse the repository at this point in the history
* SEARCH-201 Size property for SuggestCriteria;

* SEARCH-201 Size property for SuggestCriteria; Fix Unit Tests;
  • Loading branch information
antonhlazkov authored and Avariya committed Jul 31, 2018
1 parent 7708da1 commit de8607e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Criteria/SuggestCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ final class SuggestCriteria implements SerializableInterface
*/
private $track;

/**
* @var int
* @Serializer\Type("integer")
*/
private $size = 10;

/**
* @param string $query
* @return SuggestCriteria
Expand All @@ -38,4 +44,14 @@ public function setTrack(bool $track): SuggestCriteria
$this->track = $track;
return $this;
}

/**
* @param int $size
* @return SuggestCriteria
*/
public function setSize(int $size)
{
$this->size = $size;
return $this;
}
}
16 changes: 15 additions & 1 deletion tests/Builder/SuggestCriteriaBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ public function criteriaProvider()
return [
[
new SuggestCriteria(),
[]
[
'size' => 10
]
],
[
(new SuggestCriteria())->setTrack(false),
[
'track' => false,
'size' => 10
]
],
[
Expand All @@ -44,6 +47,17 @@ public function criteriaProvider()
[
'q' => 'test query',
'track' => false,
'size' => 10
]
],
[
(new SuggestCriteria())->setQuery('test query')
->setTrack(false)
->setSize(5),
[
'q' => 'test query',
'track' => false,
'size' => 5
]
],
];
Expand Down

0 comments on commit de8607e

Please # to comment.