Skip to content

Commit d0e1791

Browse files
committed
api.delete wrapper
1 parent 7edd22e commit d0e1791

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Api.php

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public function create(string $space, array $data)
1616
return $this->getSpace($space)->create($data);
1717
}
1818

19+
public function delete(string $space, $instance)
20+
{
21+
$this->getSpace($space)->delete($instance);
22+
}
23+
1924
public function find(string $space, Criteria|array|null $query = null): array
2025
{
2126
return $this->getSpace($space)->find($query);

tests/MapperTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ public function testSpaces()
235235
}
236236
}
237237
$mapper->flushChanges();
238+
$instance = $mapper->create($nick, ['nick' => 'mapper.delete']);
239+
$this->assertCount(1, $mapper->getChanges());
240+
$this->assertCount(1, $mapper->getChanges(), 'changes keep untill flush');
241+
$mapper->delete($nick, $instance);
242+
$this->assertCount(0, $mapper->getChanges(), 'insert and delete merges into nothing');
238243
}
239244

240245
$pool = new Pool(function () use ($mapper) {

0 commit comments

Comments
 (0)