function it_should_commit_shot_to_computer(GetTarget $getTarget, MapRepository $mapRepository, Map $map, $dispatcher) { $dispatcher->dispatch(ShotCommitted::NAME, Argument::type('ShipsBattle\\Domain\\Event\\ShotCommitted'))->shouldBeCalled(); $getTarget->get()->shouldNotBeCalled(); $mapRepository->update()->shouldBeCalled(); $this->commit(1, $map); }
public function commit($commiter, $map = null) { if ($commiter == 0) { $map = $this->getTarget->get(); } $event = new ShotCommitted($map); $this->dispatcher->dispatch($event::NAME, $event); $map->setStatus(1); $this->mapRepository->update(); }