/** @test */ public function it_should_not_allow_register_a_player_with_the_same_identifier() { $this->setExpectedException(PlayerAlreadyExistsException::class); $command = PlayerRegistrationStub::random(); $playerId = PlayerIdStub::create($command->id()); $this->shouldSearchPlayer($playerId, PlayerStub::identified($playerId)); $this->handler->handle($command); }
/** @test */ public function it_should_find_a_player_that_exists() { $query = PlayerFindStub::random(); $playerId = PlayerIdStub::create($query->playerId()); $player = PlayerStub::identified($playerId); $playerResponse = PlayerResponseStub::from($player); $this->shouldSearchPlayer($playerId, $player); $this->assertEquals($playerResponse, $this->handler->handle($query)); }
/** @test */ public function it_should_return_null_finding_a_player_that_does_not_exists() { $player = PlayerStub::random(); $this->assertNull($this->repository()->search($player->id())); }