Skip to content

Commit

Permalink
test(Behat): remove table from collection manager upon delete
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
  • Loading branch information
blizzz committed Oct 15, 2024
1 parent 9b5a3b3 commit 414fa2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/integration/features/bootstrap/CollectionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public function forget(string $type, int $id, ?string $alias = null): void {
if ($alias) {
unset($this->mapByAlias[$this->makeKey($type, $alias)]);
}
unset($this->itemsById[$this->makeKey($type, $id)]);
$idKey = $this->makeKey($type, $id);
unset($this->cleanUp[$idKey], $this->itemsById[$idKey]);
}

public function cleanUp(): void {
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ public function deleteTableV2(string $user, string $tableName): void {
Assert::assertEquals(404, $this->response->getStatusCode());

unset($this->tableIds[$tableName]);
if ($table = $this->collectionManager->getByAlias('table', $tableName)) {
$this->collectionManager->forget('table', $table['id']);
}
}

/**
Expand Down Expand Up @@ -915,6 +918,10 @@ public function deleteTable(string $user, string $keyword): void {
Assert::assertEquals($deletedTable['title'], $table['title']);
Assert::assertEquals($deletedTable['id'], $table['id']);

if ($tableItem = $this->collectionManager->getById('table', $table['id'])) {
$this->collectionManager->forget('table', $tableItem['id']);
}

$this->sendRequest(
'GET',
'/apps/tables/api/1/tables/'.$deletedTable['id'],
Expand Down

0 comments on commit 414fa2e

Please sign in to comment.