Exemplo n.º 1
0
 public function setUp()
 {
     parent::setUp();
     $this->user = UserStub::create();
     $this->jwtService = new JWTService();
     $this->token = Token::fromUser($this->user);
 }
Exemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     $this->user = UserStub::create();
     $this->jsonTokenService = m::mock(JsonTokenService::class);
     $this->tokenService = new TokenService($this->jsonTokenService);
 }
Exemplo n.º 3
0
 /** @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')));
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 /** @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']);
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 /** @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);
 }
Exemplo n.º 8
0
 /** @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());
 }