Example #1
0
 public function let(GameInterface $repository, GameFactory $factory)
 {
     $game = new GameEntity();
     $repository->getById(Argument::any())->willReturn($game);
     $repository->getByDateAndTeams(Argument::any(), Argument::any(), Argument::any())->willReturn($game);
     $this->beConstructedWith($repository, $factory);
 }
Example #2
0
 public function let(GameInterface $repository, GameFactory $factory)
 {
     $game_to_save = new GameEntity();
     $factory->gameEntity(array())->willReturn($game_to_save);
     $non_existing_game = new GameEntity();
     $non_existing_game->setId('non_existing');
     $factory->gameEntity(array('home_team' => 'fails'))->willReturn($non_existing_game);
     $repository->getById(null)->willReturn(true);
     $repository->getById('non_existing')->willReturn(false);
     $repository->save(Argument::any())->willReturnArgument(0);
     $this->beConstructedWith($repository, $factory);
 }
Example #3
0
 public function let(GameInterface $repository, GameFactory $factory)
 {
     $game_to_save = new GameEntity();
     $game_to_save->setDate(1);
     $factory->gameEntity(array())->willReturn($game_to_save);
     $game_to_save_that_fails = new GameEntity();
     $factory->gameEntity(array('home_team' => 'fails'))->willReturn($game_to_save_that_fails);
     $game_saved = new GameEntity();
     $repository->getById(Argument::any())->willReturn($game_saved);
     $repository->getByDateAndTeams(1, null, null)->willReturn(false);
     $repository->getByDateAndTeams(null, null, null)->willReturn(true);
     $repository->save($game_to_save)->willReturnArgument(0);
     $this->beConstructedWith($repository, $factory);
 }
Example #4
0
 public function let(GameInterface $repository, GameFactory $factory)
 {
     $repository->listAll(0, 25)->willReturn(new GameIterator(array(1, 2)));
     $this->beConstructedWith($repository, $factory);
 }