示例#1
0
 /**
  * @param string $gameId
  * @param string $word
  * @return Game
  */
 public static function gameStart($gameId, $word)
 {
     Assertion::uuid($gameId, "Not a valid uuid");
     $game = new Game();
     $dateTime = new \DateTime("now");
     $game->apply(new GameStarted($gameId, $word, $dateTime));
     return $game;
 }
示例#2
0
 /**
  * @test
  */
 public function it_can_start_a_game()
 {
     $id = $this->generator->generate();
     $this->scenario->when(function () use($id) {
         return Game::gameStart($id, "puppy");
     })->then([new GameStarted($id, "puppy", new \DateTime("now"))]);
 }
 /**
  * @param GameStart $command
  */
 public function handleGameStart(GameStart $command)
 {
     $game = Game::gameStart($command->getGameId(), $command->getWord());
     $this->repository->save($game);
 }
示例#4
0
 public static function createGame($gameId, $word)
 {
     $game = new Game();
     $game->apply(new GameStarted($gameId, $word));
     return $game;
 }