/** @test */ public function should_generate_valid_username_if_already_exists() { $first = FirstName::fromNative('Evey'); $last = LastName::fromNative('Edward'); $this->repository->shouldReceive('userOfUsername')->andReturn(true, true, null); $username = $this->registrar->generateUsername($first, $last); $this->assertEquals('eveyedward3', $username->toString()); }
public static function create() { // return 'here'; $faker = Factory::create(); $identifier = UserId::generate(); $email = Email::fromNative($faker->email); $first = FirstName::fromNative($faker->word); $last = LastName::fromNative($faker->word); $username = Username::fromNative($faker->word); $password = HashedPassword::fromNative(str_random(10)); return User::create($identifier, $email, $first, $last, $username, $password); }
/** @test */ public function should_create_from_native() { $last_name = LastName::fromNative('Edward'); $this->assertInstanceOf('Cffs\\Domain\\Model\\Identity\\LastName', $last_name); }
/** * Get the User's first name * * @return string */ public function lastName() { return LastName::fromNative($this->lastName); }