function testCalculateScore2() { $player1 = new FoosPlayer('player1', 1000); $player2 = new FoosPlayer('player2', 1000); $match = new FoosMatch($player1, 1, $player2, 2); $match->calculateScore(); $this->assertEqual($player2->getStrength(), 1100); $this->assertEqual($player1->getStrength(), 900); }
/** * Sort function for sorting arrays of Matches by Timestamp */ private static function sortMatchesByTimestamp(FoosMatch $a, FoosMatch $b) { if ($a->getTimestamp() == $b->getTimestamp()) { return 0; } return $a->getTimestamp() < $b->getTimestamp() ? 1 : -1; }