protected function execute(InputInterface $input, OutputInterface $output) { $task = $input->getArgument('task'); $command = new AddTask($task); $this->commandHandler->handle($command); $output->writeln("Task added."); }
public function testICanAddATaskFromCommand() { $command = new AddTask("Task test"); $this->commandHandler->handle($command); $workingDayFromRepo = $this->workingDayRepo->getByDate(Carbon::now()); $expectedWorkingDay = new WorkingDay(WorkingDayId::generate()); $expectedWorkingDay->addTask(new Task("Task test")); $this->assertEquals($expectedWorkingDay->getDate(), $workingDayFromRepo->getDate()); }
protected function execute(InputInterface $input, OutputInterface $output) { global $em; // Todo better injection of entity manager. $task = $input->getArgument('task'); $command = new AddTask($task); $commandHandler = new AddTaskHandler(new DoctrineWorkingDayRepository($em)); $commandHandler->handle($command); $output->writeln("Task added."); }