public function buildGame(GameInitiationRequest $request) : Game
 {
     $game = new Game();
     $this->attachAIBattlefields($game, $request->getOpponents(), $request->getSize());
     $player = $this->playerModel->createOnRequestHumanControlled($request->getPlayerName());
     $battlefield = BattlefieldModel::generate($request->getSize(), $request->getCoordinates());
     $battlefield->setPlayer($player);
     $game->addBattlefield($battlefield);
     /** for test purposes only - mark player cells as damaged */
     $battlefield->getCellByCoordinate('A2')->setFlags(CellModel::FLAG_DEAD_SHIP);
     $battlefield->getCellByCoordinate('A1')->setFlags(CellModel::FLAG_DEAD_SHIP);
     return $game;
 }
 /**
  * @see GameInitiationRequest::parse
  * @test
  */
 public function parseOnValid()
 {
     $fixture = $this->getSharedFixtureContent('game-initiation-requests/valid/2-players-7x7.json');
     $expected = json_decode($fixture);
     $request = new GameInitiationRequest($fixture);
     $this->assertCount(count($expected->coordinates), $request->getCoordinates());
     $this->assertEquals($expected->size, $request->getSize());
     $this->assertEquals($expected->playerName, $request->getPlayerName());
 }