From e0dd595a53bf97d34f8807bc996eaeea87008bfe Mon Sep 17 00:00:00 2001 From: Mohammad Alavi Date: Mon, 7 Feb 2022 20:03:51 +0330 Subject: [PATCH] add test --- .../API/Tests/Functional/GetAuthenticatedUserTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/GetAuthenticatedUserTest.php b/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/GetAuthenticatedUserTest.php index e48e21509..20eeeba7b 100644 --- a/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/GetAuthenticatedUserTest.php +++ b/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/GetAuthenticatedUserTest.php @@ -3,6 +3,7 @@ namespace App\Containers\AppSection\Authentication\UI\API\Tests\Functional; use App\Containers\AppSection\Authentication\UI\API\Tests\ApiTestCase; +use App\Containers\AppSection\User\Models\User; /** * Class GetAuthenticatedUserTest. @@ -42,4 +43,13 @@ public function testGetAuthenticatedUser(): void ]); $this->assertEquals($user->name, $responseContent->data->name); } + + public function testGetAuthenticatedUser_ByUnauthenticatedUser(): void + { + $this->testingUser = User::factory()->create(); + + $response = $this->auth(false)->makeCall(); + + $response->assertStatus(401); + } }