diff --git a/src/Chess/Application/Command/StartGame/StartGameCommand.php b/src/Chess/Application/Command/StartGame/StartGameCommand.php new file mode 100644 index 0000000..3842b6d --- /dev/null +++ b/src/Chess/Application/Command/StartGame/StartGameCommand.php @@ -0,0 +1,9 @@ +repository->save($game); + + return $game->id(); + } +} diff --git a/src/Chess/Domain/Repository/GameRepositoryInterface.php b/src/Chess/Domain/Repository/GameRepositoryInterface.php new file mode 100644 index 0000000..aa2d099 --- /dev/null +++ b/src/Chess/Domain/Repository/GameRepositoryInterface.php @@ -0,0 +1,15 @@ +savedGame = $game; + } + + public function findById(GameId $id): ?Game + { + return null; + } + }; + + $handler = new StartGameHandler($repository); + $gameId = $handler(new StartGameCommand()); + + self::assertInstanceOf(GameId::class, $gameId); + self::assertNotNull($repository->savedGame); + self::assertSame($gameId->toString(), $repository->savedGame->id()->toString()); + } +}