feat: activity page
This commit is contained in:
parent
f418b36167
commit
19395b4869
@@ -3,6 +3,7 @@
|
||||
namespace App\Tests\Domain\Shared\Adapter;
|
||||
|
||||
use App\Domain\Shared\Domain\Contract\JobRepositoryInterface;
|
||||
use App\Domain\Shared\Domain\Exception\JobNotFoundException;
|
||||
use App\Domain\Shared\Domain\Model\Job;
|
||||
use App\Domain\Shared\Domain\Model\JobStatus;
|
||||
|
||||
@@ -97,6 +98,26 @@ class InMemoryJobRepository implements JobRepositoryInterface
|
||||
return count($this->findByCriteria($criteria));
|
||||
}
|
||||
|
||||
public function delete(string $id): void
|
||||
{
|
||||
if (!isset($this->jobs[$id])) {
|
||||
throw JobNotFoundException::withId($id);
|
||||
}
|
||||
|
||||
unset($this->jobs[$id]);
|
||||
}
|
||||
|
||||
public function deleteByCriteria(array $criteria): int
|
||||
{
|
||||
$toDelete = $this->findByCriteria($criteria);
|
||||
|
||||
foreach ($toDelete as $job) {
|
||||
unset($this->jobs[$job->id]);
|
||||
}
|
||||
|
||||
return count($toDelete);
|
||||
}
|
||||
|
||||
public function clear(): void
|
||||
{
|
||||
$this->jobs = [];
|
||||
|
||||
Reference in New Issue
Block a user