-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
81 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,8 @@ | |
|
||
use App\Models\User; | ||
use Carbon\Carbon; | ||
use Illuminate\Http\Response; | ||
use Illuminate\Support\Facades\Log; | ||
use Symfony\Component\HttpFoundation\Response as ResponseAlias; | ||
|
||
/** | ||
* Class UserTest | ||
|
@@ -24,7 +24,7 @@ public function it_responds_with_an_error_if_the_user_email_is_empty() | |
'email' => '', | ||
'password' => 'mypassword', | ||
] | ||
)->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); | ||
)->assertStatus(ResponseAlias::HTTP_UNPROCESSABLE_ENTITY); | ||
|
||
$decoded = json_decode($response->getContent(), true); | ||
|
||
|
@@ -41,7 +41,7 @@ public function it_responds_with_an_error_if_the_user_email_is_null() | |
'POST', '/api/v1/auth/login', [ | ||
'password' => 'mypassword', | ||
] | ||
)->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); | ||
)->assertStatus(ResponseAlias::HTTP_UNPROCESSABLE_ENTITY); | ||
|
||
$decoded = json_decode($response->getContent(), true); | ||
|
||
|
@@ -59,7 +59,7 @@ public function it_responds_with_an_error_if_the_user_password_is_empty() | |
'email' => '[email protected]', | ||
'password' => '', | ||
] | ||
)->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); | ||
)->assertStatus(ResponseAlias::HTTP_UNPROCESSABLE_ENTITY); | ||
|
||
$decoded = json_decode($response->getContent(), true); | ||
|
||
|
@@ -76,7 +76,7 @@ public function it_responds_with_an_error_if_the_user_password_is_null() | |
'POST', '/api/v1/auth/login', [ | ||
'email' => '[email protected]', | ||
] | ||
)->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); | ||
)->assertStatus(ResponseAlias::HTTP_UNPROCESSABLE_ENTITY); | ||
|
||
$decoded = json_decode($response->getContent(), true); | ||
|
||
|
@@ -91,7 +91,7 @@ public function it_responds_with_an_error_if_the_request_does_not_contain_email_ | |
{ | ||
$response = $this->json( | ||
'POST', '/api/v1/auth/login', [] | ||
)->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); | ||
)->assertStatus(ResponseAlias::HTTP_UNPROCESSABLE_ENTITY); | ||
|
||
$decoded = json_decode($response->getContent(), true); | ||
|
||
|
@@ -176,7 +176,7 @@ public function it_responds_with_a_404_when_attempting_to_signin_a_user_that_doe | |
'email' => '[email protected]', | ||
'password' => 'invalidpassword', | ||
] | ||
)->assertStatus(Response::HTTP_NOT_FOUND); | ||
)->assertStatus(ResponseAlias::HTTP_NOT_FOUND); | ||
} | ||
|
||
/** | ||
|
@@ -220,14 +220,14 @@ public function it_can_logout_an_existing_user() | |
] | ||
); | ||
|
||
$respose = $this->json( | ||
$response = $this->json( | ||
'POST', '/api/v1/auth/login', [ | ||
'email' => $email, | ||
'password' => $password, | ||
] | ||
); | ||
|
||
$decoded = json_decode($respose->getContent(), true); | ||
$decoded = json_decode($response->getContent(), true); | ||
|
||
$this->json( | ||
'GET', '/api/v1/auth/logout', [], [ | ||
|
@@ -260,7 +260,7 @@ public function logout_responds_with_an_error_if_token_is_invalid() | |
] | ||
] | ||
) | ||
->assertStatus(Response::HTTP_BAD_REQUEST) | ||
->assertStatus(ResponseAlias::HTTP_BAD_REQUEST) | ||
->assertExactJson([ | ||
'Not found or Invalid Credentials.' | ||
]); | ||
|
@@ -282,22 +282,22 @@ public function it_can_validate_access_token_success() | |
] | ||
); | ||
|
||
$respose = $this->json( | ||
$response = $this->json( | ||
'POST', '/api/v1/auth/login', [ | ||
'email' => $email, | ||
'password' => $password, | ||
] | ||
); | ||
|
||
$decoded = json_decode($respose->getContent(), true); | ||
$decoded = json_decode($response->getContent(), true); | ||
|
||
$this | ||
->json( | ||
'POST', '/api/v1/auth/validate', [], [ | ||
'Authorization' => 'Bearer ' . $decoded['token'] | ||
] | ||
) | ||
->assertStatus(Response::HTTP_OK) | ||
->assertStatus(ResponseAlias::HTTP_OK) | ||
->assertExactJson([ | ||
'validated' => true | ||
]); | ||
|
@@ -314,9 +314,9 @@ public function it_can_validate_access_token_fails() | |
'Authorization' => 'Bearer invalid-token' | ||
] | ||
) | ||
->assertStatus(Response::HTTP_UNAUTHORIZED) | ||
->assertStatus(ResponseAlias::HTTP_UNAUTHORIZED) | ||
->assertExactJson([ | ||
'error' => 'Expired or Tnvalid token.' | ||
'error' => 'Expired or Invalid token.' | ||
]); | ||
} | ||
} |
Oops, something went wrong.