diff --git a/tests/Integration/Demo/Auth/AuthTest.php b/tests/Integration/Demo/Auth/AuthTest.php index b93737b..5c79e30 100644 --- a/tests/Integration/Demo/Auth/AuthTest.php +++ b/tests/Integration/Demo/Auth/AuthTest.php @@ -16,6 +16,7 @@ class AuthTest extends IntegrationTestCase public function testLoggingInAndOutUnsetsTokenCookie(): void { $user = $this->createUser(password: 'foo'); + // TODO: Update the HTTP client to accept a Headers value as the headers, too $loginResponse = $this->post('/demo/auth/login', ['Authorization' => 'Basic ' . \base64_encode("$user->email:foo")]); $this->assertHasCookie($loginResponse, 'authToken'); // TODO: Add an easier way to parse response cookie value in integration tests (probably by including ResponseHeaderParser) @@ -43,6 +44,7 @@ public function testLoggingOutWithoutTokenCookieSetStillUnsetsTokenCookie(): voi { $response = $this->post('/demo/auth/logout'); $this->assertStatusCodeEquals(HttpStatusCode::Ok, $response); + // TODO: Add assertion that checks if a cookie was unset $this->assertHeaderMatchesRegex('/authToken=;/', $response, 'Set-Cookie'); } } diff --git a/tests/Integration/Demo/Users/UserTest.php b/tests/Integration/Demo/Users/UserTest.php index 38afc26..b74a563 100644 --- a/tests/Integration/Demo/Users/UserTest.php +++ b/tests/Integration/Demo/Users/UserTest.php @@ -40,8 +40,8 @@ public function testDeletingAnotherUserAsAdminReturns204(): void $identity->withNameIdentifier('foo') ->withRoles('admin'); })->build(); - $deleteUserResponse = $this->actingAs($adminUser)->delete("/demo/users/$createdUser->id"); - $this->assertStatusCodeEquals(HttpStatusCode::NoContent, $deleteUserResponse); + $response = $this->actingAs($adminUser)->delete("/demo/users/$createdUser->id"); + $this->assertStatusCodeEquals(HttpStatusCode::NoContent, $response); } public function testDeletingAnotherUserAsNonAdminReturns403(): void @@ -65,8 +65,8 @@ public function testDeletingNonExistentUserReturns404(): void ->withRoles('admin'); })->build(); // Pass in a dummy user ID - $deleteUserResponse = $this->actingAs($adminUser)->delete('/demo/users/0'); - $this->assertStatusCodeEquals(HttpStatusCode::NotFound, $deleteUserResponse); + $response = $this->actingAs($adminUser)->delete('/demo/users/0'); + $this->assertStatusCodeEquals(HttpStatusCode::NotFound, $response); } public function testDeletingYourOwnUserReturns204(): void