/**
  * @see BattlefieldModel::flagWaterAroundShip
  * @test
  */
 public function flagWaterAroundShipOnA1AlreadyDead()
 {
     $battlefield = MockFactory::getBattlefieldMock();
     $battlefield->getCellByCoordinate('A1')->setFlags(CellModel::FLAG_DEAD);
     $cell = $battlefield->getCellByCoordinate('B2')->setFlags(CellModel::FLAG_SHIP);
     BattlefieldModel::flagWaterAroundShip($cell);
     foreach (['A2', 'A3', 'B1', 'B3', 'C1', 'C2', 'C3'] as $coordinate) {
         $this->assertTrue($battlefield->getCellByCoordinate($coordinate)->hasFlag(CellModel::FLAG_SKIP));
     }
 }
 /**
  * @since 21.0
  *
  * @param Battlefield $battlefield
  * @param Player      $attacker
  * @param Cell        $cell
  *
  * @return bool - true if target battlefield do not have any life ships, otherwise false
  * @throws GameProcessorException
  */
 protected function processPlayerTurnOnBattlefield(Battlefield $battlefield, Player $attacker, Cell $cell) : bool
 {
     /** do not process turn on itself */
     if ($battlefield->getPlayer() === $attacker) {
         throw new GameProcessorException('player attacked itself');
     }
     $cell = $this->processPlayerTurn($battlefield, $cell);
     if (CellModel::isShipDead($cell)) {
         BattlefieldModel::flagWaterAroundShip($cell);
         return !BattlefieldModel::hasUnfinishedShips($battlefield);
     }
     return false;
 }