public function handle(DeleteTask $command) { $taskDescription = new TaskDescription($command->getDescription()); $workingDay = $this->repo->getByDate(Carbon::now()); $workingDay->deleteTaskWithDescription($taskDescription); $this->repo->add($workingDay); }
public function testICanDeleteTaskFromTheWorkingDayFromCommand() { $workingDay = new WorkingDay(WorkingDayId::generate()); $workingDay->addTask(new Task("Task test")); $this->workingDayRepo->add($workingDay); $this->commandHandler->handle(new DeleteTask("Task test")); $this->assertCount(0, $workingDay->getTasks()); }