public function setUp() { parent::setUp(); $this->user = UserStub::create(); $this->jwtService = new JWTService(); $this->token = Token::fromUser($this->user); }
public function setUp() { parent::setUp(); $this->user = UserStub::create(); $this->jsonTokenService = m::mock(JsonTokenService::class); $this->tokenService = new TokenService($this->jsonTokenService); }
/** @test */ public function should_return_true_when_user_email_is_unique() { $this->repository->shouldReceive('userOfEmail')->andReturn(null); $user = UserStub::create(); $userRepo = $this->repository; $this->assertTrue($this->guard->handle(compact('user', 'userRepo'))); }
public function setUp() { parent::setUp(); $this->user = UserStub::create(); $this->userRepository = m::mock('Cffs\\Domain\\Model\\Identity\\UserRepository'); $this->hashingService = m::mock(HashingService::class); $this->authService = new AuthService($this->userRepository, $this->hashingService); }
/** @test */ public function should_format_user_item_properly() { $user = UserStub::create(); $jsonUser = $this->jsonTransformer->item($user, new UserTransformer()); $this->assertEquals($user->email()->toString(), $jsonUser['email']); $this->assertEquals($user->firstName()->toString(), $jsonUser['firstName']); $this->assertEquals($user->lastName()->toString(), $jsonUser['lastName']); $this->assertEquals($user->id()->toString(), $jsonUser['id']); $this->assertEquals($user->username()->toString(), $jsonUser['username']); }
public function setUp() { parent::setUp(); $this->user = UserStub::create(); $this->fixture = ['id' => ReminderId::generate(), 'code' => ReminderCode::generate(), 'email' => new Email('*****@*****.**')]; $this->users = m::mock('Cffs\\Domain\\Model\\Identity\\UserRepository'); $this->reminders = m::mock('Cffs\\Domain\\Model\\Identity\\ReminderRepository'); $this->hasher = m::mock('Cffs\\Domain\\Services\\Identity\\HashingService'); $this->service = new ReminderService($this->reminders, $this->users, $this->hasher); }
/** @test */ public function should_return_response_lol() { $credentials = ['email' => 'badEmail', 'password' => 'password']; $this->request->shouldReceive('only')->andReturn($credentials); $this->authService->shouldReceive('loginWithCredentials')->andReturn(UserStub::create()); $this->tokenService->shouldReceive('requestAccessToken')->andReturn(EncodedToken::fromNative('token')); $this->transformer->shouldReceive('item')->andReturn('asdf'); $response = $this->authController->Login($this->request); $this->assertInstanceOf('Illuminate\\Http\\JsonResponse', $response); }
/** @test */ public function should_add_new_user() { $userStub = UserStub::create(); $user = $this->repository->add($userStub); $this->em->clear(); $user = $this->repository->userOfEmail($userStub->email()); $this->assertEquals($userStub->id(), $user->id()); $this->assertEquals($userStub->email(), $user->email()); $this->assertEquals($userStub->username(), $user->username()); $this->assertEquals($userStub->firstName(), $user->firstName()); $this->assertEquals($userStub->lastName(), $user->lastName()); }