/**
  * @test
  * @expectedException \Assert\InvalidArgumentException
  */
 public function it_can_not_chose_a_letter_when_finished()
 {
     // Prefined variables
     $id = $this->generator->generate();
     $datetime = new \DateTime("now");
     $this->scenario->withAggregateId($id)->given([new GameStarted($id, "l", $datetime), new LetterGuessedCorrectly($id, 'l'), new GameWon($id, $datetime)])->when(new ChooseLetter($id, 't'))->then([]);
 }
 /**
  * Generates a new Identifier instance with a uuid
  */
 public static function generate()
 {
     $generator = new Version4Generator();
     return new static($generator->generate());
 }
 /**
  * @test
  */
 public function it_should_generate_a_version_4_uuid()
 {
     $generator = new Version4Generator();
     $uuid = $generator->generate();
     $uuidObject = call_user_func([$this->className, 'fromString'], $uuid);
     $this->assertEquals(4, $uuidObject->getVersion());
 }
Exemple #4
1
 /**
  * @test
  */
 public function it_can_win_a_game()
 {
     $id = $this->generator->generate();
     $this->scenario->withAggregateId($id)->given([new GameStarted($id, "lol", new \DateTime("now")), new LetterGuessedCorrectly($id, 'l')])->when(function ($game) use($id) {
         //  $game->chooseLetter($id, 'l');
         $game->chooseLetter($id, 'o');
     })->then([new LetterGuessedCorrectly($id, 'o'), new GameWon($id, new \DateTime("now"))]);
 }
 /**
  * @test
  */
 public function it_should_generate_a_version_4_uuid()
 {
     $generator = new Version4Generator();
     $uuid = $generator->generate();
     $uuidObject = Uuid::fromString($uuid);
     $this->assertEquals(4, $uuidObject->getVersion());
 }
 /**
  * @test
  */
 public function it_can_set_a_wrong_letter()
 {
     $gameId = $this->generator->generate();
     $dateTime = new \DateTime("now");
     $this->scenario->given([new GameStarted($gameId, "testsuite", $dateTime)])->when(new WrongLetterGuessed($gameId, 'p'))->then([$this->applyLetterWithReadModel($gameId, "testsuite", $dateTime, 1, 'p')]);
 }