/**
  * Handles a GameMoveCommand
  *
  * @param  GameMoveCommand $command
  * @return void
  */
 public function handleGameMoveCommand(GameMoveCommand $command)
 {
     ContextContainer::setContext($command->getContext());
     try {
         $miniGame = $this->gameManager->load($command->getGameId());
         $miniGame->play($command->getPlayerId(), $command->getMove());
         $this->gameManager->save($miniGame);
     } catch (\Exception $e) {
         $this->errorHandler->handle(new MiniGameAppErrorEvent($command->getGameId(), $command->getPlayerId(), $e->getMessage()), $command->getContext());
     }
     ContextContainer::reset();
 }
Пример #2
0
 private function givenGameDoesNotExist()
 {
     $this->gameManager->shouldReceive('load')->with($this->gameId)->andThrow(GameNotFoundException::class);
 }