Skip to content

Commit

Permalink
Made var names consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbyoung committed Jun 23, 2023
1 parent 9b2a80b commit e4a82dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions tests/Integration/Demo/Auth/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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');
}
}
8 changes: 4 additions & 4 deletions tests/Integration/Demo/Users/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e4a82dc

Please sign in to comment.