示例#1
0
 public function testAvarageScore_WithNull_ReturnNull()
 {
     $r1 = $this->getMock('Rating', ['getScore']);
     $r1->method('getScore')->willReturn(null);
     $game = new Game();
     $game->setRatings([$r1]);
     $this->assertEquals(null, $game->getAvg());
 }
 public function findByUSerId($id)
 {
     $games = [];
     for ($i = 0; $i < 6; $i++) {
         $game = new Game($i);
         $game->setTitle("Game ." . $i);
         $game->setImagePath("images/game.jpg");
         $rating = new Rating();
         $rating->setScore(4.5);
         $game->setRatings([$rating]);
         $games[] = $game;
     }
     return $games;
 }