/**
  * @group Helpers
  * @group RoundSimulator
  */
 public function testRoundSimulator()
 {
     $match = \App\Lib\DsManager\Models\Orm\Match::where(['simulated' => false])->whereNotNull('league_round_id')->get()->random(1);
     $this->assertNotEmpty($match);
     $result = \App\Lib\DsManager\Helpers\MatchSimulator::simulateRound($match->league_round_id);
     $this->assertNotEmpty($result);
     $match = \App\Lib\DsManager\Models\Orm\Match::where(['id' => $match->id, 'simulated' => true])->first();
     $this->assertNotEmpty($match);
     $round = \App\Lib\DsManager\Models\Orm\LeagueRound::find($match->league_round_id);
     $this->assertNotEmpty($round);
     $this->assertTrue($round->simulated);
 }
 /**
  * @param $roundId
  * @return string
  */
 public static function simulateRound($roundId)
 {
     $result = self::getCompleteRound($roundId);
     if (!empty($result) && !$result->simulated) {
         $matches = Match::where(['league_round_id' => $roundId])->get();
         foreach ($matches as $match) {
             self::simulateSimpleResult($match->id)->toArray();
         }
         LeagueRound::find($roundId)->update(['simulated' => true]);
         $result = self::getCompleteRound($roundId);
     }
     return $result;
 }