/**
  * @see BattlefieldModel::generate
  * @test
  */
 public function generate()
 {
     $shipCells = ['A1', 'A3', 'A5'];
     $battlefield = BattlefieldModel::generate(7, $shipCells);
     $this->assertCount(49, $battlefield->getCells());
     foreach ($battlefield->getCells() as $cell) {
         $expectedFlag = in_array($cell->getCoordinate(), $shipCells) ? CellModel::FLAG_SHIP : CellModel::FLAG_NONE;
         $this->assertEquals($expectedFlag, $cell->getFlags());
     }
 }
 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;
 }
 public static function getBattlefieldMock(int $size = 7) : Battlefield
 {
     $battlefield = BattlefieldModel::generate($size)->setPlayer(static::getPlayerMock(''));
     return $battlefield;
 }