From a2e2639085165a6f50a454c1ff94136382d2d1c6 Mon Sep 17 00:00:00 2001 From: Mohammad Alavi Date: Fri, 8 Apr 2022 19:44:40 +0430 Subject: [PATCH] fix: tests --- .../Functional/GetAuthenticatedUserTest.php | 21 +++++++++++++++++++ 1 file changed, 21 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 3ebd90064..1ab30384e 100644 --- a/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/GetAuthenticatedUserTest.php +++ b/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/GetAuthenticatedUserTest.php @@ -36,6 +36,27 @@ public function testGetAuthenticatedUser(): void 'name' => $user->name, 'gender' => $user->gender, 'birth' => $user->birth, + ]); + $this->assertEquals($user->name, $responseContent->data->name); + } + + public function testGetAuthenticatedUserAsAdmin(): void + { + $user = $this->getTestingUser(createUserAsAdmin: true); + + $response = $this->makeCall(); + + $response->assertStatus(200); + $responseContent = $this->getResponseContentObject(); + $this->assertResponseContainKeyValue([ + 'object' => 'User', + 'id' => $user->getHashedKey(), + 'email' => $user->email, + 'email_verified_at' => $user->email_verified_at, + 'name' => $user->name, + 'gender' => $user->gender, + 'birth' => $user->birth, + 'real_id' => $user->id, 'created_at' => $user->created_at, 'updated_at' => $user->updated_at, 'readable_created_at' => $user->created_at->diffForHumans(),