/** @test */ public function should_return_user() { $this->userRepository->shouldReceive('userOfEmail')->andReturn($this->user); $this->hashingService->shouldReceive('check')->andReturn(true); $credentials = ['email' => '*****@*****.**', 'password' => 'password']; $user = $this->authService->loginWithCredentials($credentials); $this->assertEquals($user, $this->user); }
/** @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); }