diff --git a/src/Stopwords.php b/src/Stopwords.php index a8dc274a..116c14cc 100644 --- a/src/Stopwords.php +++ b/src/Stopwords.php @@ -6,7 +6,7 @@ use Typesense\Exceptions\TypesenseClientError; /** - * Class Document + * Class Stopwords * * @package \Typesense * @date 4/5/20 @@ -22,7 +22,7 @@ class Stopwords public const STOPWORDS_PATH = '/stopwords'; /** - * Document constructor. + * Stopwords constructor. * * @param ApiCall $apiCall */ @@ -43,6 +43,7 @@ public function get(string $stopwordsName) [] ); } + /** * @return array|string * @throws HttpClientException @@ -54,32 +55,27 @@ public function getAll() } /** - * @param array $options + * @param array $stopwordSet * * @return array * @throws HttpClientException * @throws TypesenseClientError */ - public function put(array $options = []) + public function put(array $stopwordSet) { - $stopwordsName = $options['stopwords_name']; - $stopwordsData = $options['stopwords_data']; - return $this->apiCall->put( - $this->endpointPath($stopwordsName), - ['stopwords' => $stopwordsData] - ); + return $this->apiCall->put($this->endpointPath($stopwordSet['name']), $stopwordSet); } /** - * @param $presetName + * @param $stopwordsName * @return array * @throws HttpClientException * @throws TypesenseClientError */ - public function delete($presetName) + public function delete($stopwordsName) { return $this->apiCall->delete( - $this->endpointPath($presetName) + $this->endpointPath($stopwordsName) ); } diff --git a/tests/Feature/StopwordsTest.php b/tests/Feature/StopwordsTest.php index 508512b2..7c283042 100644 --- a/tests/Feature/StopwordsTest.php +++ b/tests/Feature/StopwordsTest.php @@ -16,8 +16,9 @@ protected function setUp(): void $this->stopwordsUpsertRes = $this->client()->stopwords->put( [ - "stopwords_name" => "stopword_set1", - "stopwords_data" => ["Germany"], + "name" => "stopword_set1", + "stopwords" => ["Germany"], + "locale" => "en" ] ); } @@ -34,6 +35,7 @@ public function testCanUpsertAStopword(): void { $this->assertEquals("stopword_set1", $this->stopwordsUpsertRes['id']); $this->assertEquals(["Germany"], $this->stopwordsUpsertRes['stopwords']); + $this->assertEquals('en', $this->stopwordsUpsertRes['locale']); } public function testCanRetrieveAStopword(): void