From dc5b6478d97e5cdb8c8e2fd0625a484a8893dd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Mon, 26 Jun 2023 16:46:59 +0200 Subject: [PATCH] Improve test after merging #1118 --- tests/Collection/SearchIndexFunctionalTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Collection/SearchIndexFunctionalTest.php b/tests/Collection/SearchIndexFunctionalTest.php index 67886411d..72e9fac81 100644 --- a/tests/Collection/SearchIndexFunctionalTest.php +++ b/tests/Collection/SearchIndexFunctionalTest.php @@ -63,14 +63,14 @@ public function testIndexLifecycle(): void $this->assertSame($name, $createdName); // Wait for the index to be ready - $count = 0; + $maxWaitingTime = 90; do { sleep(1); $result = $collection->listSearchIndexes($name); $this->assertInstanceOf(CachingIterator::class, $result); $index = $result->current(); - if ($count++ > 90) { + if ($maxWaitingTime-- <= 0) { $this->fail('Search index did not become queryable'); } } while (! $index->queryable); @@ -84,16 +84,16 @@ public function testIndexLifecycle(): void $collection->dropSearchIndex($name); // Wait for the index to be deleted - $count = 0; + $maxWaitingTime = 90; do { sleep(1); $result = $collection->listSearchIndexes($name); $this->assertInstanceOf(CachingIterator::class, $result); - if ($count++ > 90) { + if ($maxWaitingTime-- <= 0) { $this->fail('Search index was not deleted'); } - } while ($result->valid()); + } while ($result->count() !== 0); } /**