Skip to content

Commit

Permalink
Fix integration test for session cookie auth
Browse files Browse the repository at this point in the history
  • Loading branch information
devdot committed Jul 30, 2024
1 parent 9632fd0 commit 34e90d5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/Integration/Requests/AuthRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,20 @@ public function testAuthWithSessionCookie(): void
CTConfig::setApiUrl(IntegrationTestData::get()->getApiUrl());

// verify that we are not logged in now
$this->assertFalse(CTConfig::validateAuthentication());
$this->assertNull(CTConfig::getSessionCookieString());

// login using the cookie
$auth = CTConfig::authWithSessionCookie($cookie);
$this->assertSame($userId, $auth->userId);
$this->assertEquals($userId, $auth->userId);
$this->assertTrue(CTConfig::validateAuthentication());

// confirm we are still logged in
$authValid = CTConfig::validateAuthentication();
$this->assertTrue($authValid);

// confirm the session cookie was updated (but not replaced)
$updatedCookie = CTConfig::getSessionCookieString();
$this->assertSame(explode(';', $cookie, 2)[0], explode(';', $updatedCookie, 2)[0]);
}

public function testAuthWithUserIdAndLoginToken()
Expand Down

0 comments on commit 34e90d5

Please sign in to comment.