From b4983ca9b5641d88a7d304868a8a39cb3425f5de Mon Sep 17 00:00:00 2001 From: yaroslavpopovic Date: Thu, 20 Jun 2024 17:12:28 +0200 Subject: [PATCH] Update CollectionsTest.php Add testCollectionExits --- .../Integration/Endpoints/CollectionsTest.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/Integration/Endpoints/CollectionsTest.php b/tests/Integration/Endpoints/CollectionsTest.php index b4af1ce..9c215b9 100644 --- a/tests/Integration/Endpoints/CollectionsTest.php +++ b/tests/Integration/Endpoints/CollectionsTest.php @@ -54,6 +54,24 @@ public function testCollections(): void $this->assertEquals('ok', $response['status']); } + /** + * @throws InvalidArgumentException + */ + public function testCollectionExits(): void + { + $collections = new Collections($this->client); + $collections->setCollectionName('sample-collection'); + + $response = $collections->create(self::sampleCollectionOption()); + $this->assertEquals('ok', $response['status']); + + $response = $collections->exists(); + $this->assertEquals(true, $response['result']['exists']); + + $response = $collections->setCollectionName('sample-collection-that-not-exists')->exists(); + $this->assertEquals(false, $response['result']['exists']); + } + public function testCollectionsCluster(): void { $collections = new Collections($this->client); @@ -185,4 +203,4 @@ protected function tearDown(): void $collections->setCollectionName('sample-collection')->delete(); $collections->setCollectionName('other-collection')->delete(); } -} \ No newline at end of file +}