Skip to content

Commit 07c2114

Browse files
committed
fix: tests
1 parent 396d3df commit 07c2114

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/BEditaClient.php

+6-9
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,11 @@ public function restoreObject($id, string $type): ?array
383383
*/
384384
public function restoreObjects(array $ids, string $type = 'objects'): ?array
385385
{
386-
return $this->patch(
387-
'/trash',
388-
json_encode([
389-
'data' => [
390-
'id' => $ids,
391-
'type' => $type,
392-
],
393-
])
394-
);
386+
$res = null;
387+
foreach ($ids as $id) {
388+
$res = !empty($res) ? $res : $this->restoreObject($id, $type);
389+
}
390+
391+
return $res;
395392
}
396393
}

tests/TestCase/BEditaClientTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -743,13 +743,13 @@ public function testDeleteRemoveRestore(): void
743743
static::assertEquals(204, $this->client->getStatusCode());
744744
static::assertEquals('No Content', $this->client->getStatusMessage());
745745
static::assertEmpty($response);
746-
$response = $this->client->getObject($ids[0], $type);
746+
$response = $this->client->getObjects($type, ['filter' => ['id' => $ids[0]]]);
747747
static::assertEmpty($response['data']);
748748
$response = $this->client->restoreObjects($ids, $type);
749749
static::assertEquals(204, $this->client->getStatusCode());
750750
static::assertEquals('No Content', $this->client->getStatusMessage());
751751
static::assertEmpty($response);
752-
$response = $this->client->getObject($ids[0], $type);
752+
$response = $this->client->getObjects($type, ['filter' => ['id' => $ids[0]]]);
753753
static::assertNotEmpty($response['data']);
754754
$response = $this->client->removeObjects($ids, $type);
755755
static::assertEquals(204, $this->client->getStatusCode());

0 commit comments

Comments
 (0)