Skip to content

Commit 356176e

Browse files
committed
Improve test after merging #1118
1 parent 536668e commit 356176e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/Collection/SearchIndexFunctionalTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ public function testIndexLifecycle(): void
6363
$this->assertSame($name, $createdName);
6464

6565
// Wait for the index to be ready
66-
$count = 0;
66+
$maxWaitingTime = 90;
6767
do {
6868
sleep(1);
6969
$result = $collection->listSearchIndexes($name);
7070
$this->assertInstanceOf(CachingIterator::class, $result);
7171
$index = $result->current();
7272

73-
if ($count++ > 90) {
73+
if ($maxWaitingTime-- <= 0) {
7474
$this->fail('Search index did not become queryable');
7575
}
7676
} while (! $index->queryable);
@@ -84,16 +84,16 @@ public function testIndexLifecycle(): void
8484
$collection->dropSearchIndex($name);
8585

8686
// Wait for the index to be deleted
87-
$count = 0;
87+
$maxWaitingTime = 90;
8888
do {
8989
sleep(1);
9090
$result = $collection->listSearchIndexes($name);
9191
$this->assertInstanceOf(CachingIterator::class, $result);
9292

93-
if ($count++ > 90) {
93+
if ($maxWaitingTime-- <= 0) {
9494
$this->fail('Search index was not deleted');
9595
}
96-
} while ($result->valid());
96+
} while ($result->count() !== 0);
9797
}
9898

9999
/**

0 commit comments

Comments
 (0)