/** @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_throw_an_exception_finding_a_player_that_does_not_exists() { $this->setExpectedException(PlayerNotExistsException::class); $query = PlayerFindStub::random(); $playerId = PlayerIdStub::create($query->playerId()); $this->shouldSearchPlayer($playerId); $this->handler->handle($query); }
public static function random() { return self::create(PlayerIdStub::random()->value()); }
public static function random() { return self::create(PlayerIdStub::random(), PlayerNameStub::random()); }
public static function named($name) { return self::create(PlayerIdStub::random()->value(), $name); }