public function testListTasksReturnsArrayOfTwoTasksCreated() { $workingDayWithTwoTasks = $this->createWorkingDayWithTwoTasks(); $repo = new InMemoryWorkingDayRepository(); $repo->add($workingDayWithTwoTasks); $listTasksHandler = new ListTasksHandler($repo); $tasks = $listTasksHandler->handle(new ListTasks()); $this->assertCount(2, $tasks); }
public function testItWorksCorrectlyWhenYouHaveAWorkingDay() { $inMemoryRepo = new InMemoryWorkingDayRepository(); $workingDay = new WorkingDay($inMemoryRepo->nextIdentity()); $workingDay->addTask(new Task("Going to the toilet.")); $inMemoryRepo->add($workingDay); $this->mockMailProvider->expects($this->once())->method('sendReportOf')->with($workingDay); $sendReportHandler = new SendReportHandler($this->mockMailProvider, $inMemoryRepo); $sendReportHandler->handle(new SendReport()); }
/** * Tests that updating a repo saving and retrieving means that we have * and updated version of the file. */ public function testRepoUpdatesWorkDayIfNewIsAddedWithSameData() { $this->workingDayWithTask = $this->getWorkingDayWithTask(); $this->inMemoryRepo->add($this->workingDayWithTask); $workingDayFromRepo = $this->inMemoryRepo->getByDate(Carbon::now()); $this->assertSame($this->workingDayWithTask, $workingDayFromRepo); $workingDayFromRepo->addTask(new Task('Beber un poco de vino')); $workingDayFromRepo = $this->inMemoryRepo->getByDate(Carbon::now()); $this->assertSame($this->workingDayWithTask, $workingDayFromRepo); }