Skip to content

Commit 50e82f9

Browse files
authored
Merge pull request #341 from meilisearch/indexes-changes
Apply indexes changes v1
2 parents deb462a + a00bde1 commit 50e82f9

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/Endpoints/Indexes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ public function create(string $uid, array $options = []): array
7777
public function all(): array
7878
{
7979
$indexes = [];
80+
$response = $this->allRaw();
8081

81-
foreach ($this->allRaw() as $index) {
82+
foreach ($response['results'] as $index) {
8283
$indexes[] = $this->newInstance($index);
8384
}
8485

tests/Endpoints/ClientTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function testClientIndexMethodsAlwaysReturnArray(): void
1717
/* @phpstan-ignore-next-line */
1818
$this->assertIsArray($this->client->getAllIndexes());
1919
/* @phpstan-ignore-next-line */
20-
$this->assertIsArray($this->client->getAllRawIndexes());
20+
$this->assertIsArray($this->client->getAllRawIndexes()['results']);
2121
/* @phpstan-ignore-next-line */
2222
$this->assertIsArray($this->client->getRawIndex($index->getUid()));
2323
}
@@ -40,7 +40,7 @@ public function testGetAllIndexesWhenEmpty(): void
4040

4141
public function testGetAllRawIndexesWhenEmpty(): void
4242
{
43-
$response = $this->client->getAllRawIndexes();
43+
$response = $this->client->getAllRawIndexes()['results'];
4444

4545
$this->assertEmpty($response);
4646
}
@@ -112,7 +112,7 @@ public function testGetAllRawIndexes(): void
112112
$this->createEmptyIndex($indexA);
113113
$this->createEmptyIndex($indexB);
114114

115-
$res = $this->client->getAllRawIndexes();
115+
$res = $this->client->getAllRawIndexes()['results'];
116116

117117
$this->assertNotInstanceOf(Indexes::class, $res[0]);
118118
}

tests/Endpoints/IndexTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function testWaitForTaskDefault(): void
178178
$this->assertSame($response['status'], 'succeeded');
179179
$this->assertSame($response['uid'], $promise['taskUid']);
180180
$this->assertArrayHasKey('type', $response);
181-
$this->assertSame($response['type'], 'documentAddition');
181+
$this->assertSame($response['type'], 'documentAdditionOrUpdate');
182182
$this->assertArrayHasKey('duration', $response);
183183
$this->assertArrayHasKey('startedAt', $response);
184184
$this->assertArrayHasKey('finishedAt', $response);
@@ -192,7 +192,7 @@ public function testWaitForTaskWithTimeoutAndInterval(): void
192192
$this->assertSame($response['status'], 'succeeded');
193193
$this->assertSame($response['uid'], $promise['taskUid']);
194194
$this->assertArrayHasKey('type', $response);
195-
$this->assertSame($response['type'], 'documentAddition');
195+
$this->assertSame($response['type'], 'documentAdditionOrUpdate');
196196
$this->assertArrayHasKey('duration', $response);
197197
$this->assertArrayHasKey('enqueuedAt', $response);
198198
$this->assertArrayHasKey('startedAt', $response);
@@ -207,7 +207,7 @@ public function testWaitForTaskWithTimeout(): void
207207
$this->assertSame($response['status'], 'succeeded');
208208
$this->assertSame($response['uid'], $promise['taskUid']);
209209
$this->assertArrayHasKey('type', $response);
210-
$this->assertSame($response['type'], 'documentAddition');
210+
$this->assertSame($response['type'], 'documentAdditionOrUpdate');
211211
$this->assertArrayHasKey('duration', $response);
212212
$this->assertArrayHasKey('enqueuedAt', $response);
213213
$this->assertArrayHasKey('startedAt', $response);
@@ -218,7 +218,7 @@ public function testExceptionWhenTaskTimeOut(): void
218218
{
219219
$res = $this->index->addDocuments([['id' => 1, 'title' => 'Pride and Prejudice']]);
220220
$this->expectException(TimeOutException::class);
221-
$this->index->waitForTask($res['uid'], 0, 20);
221+
$this->index->waitForTask($res['taskUid'], 0, 20);
222222
}
223223

224224
public function testDeleteIndexes(): void

0 commit comments

Comments
 (0)