From 420bb7571e87cf8742485a6ff7076dced7596fa9 Mon Sep 17 00:00:00 2001 From: Thomas Kuschan Date: Tue, 30 Jul 2024 17:32:59 +0200 Subject: [PATCH] Minor improvements to session cookie test --- tests/Integration/Requests/AuthRequestTest.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/Integration/Requests/AuthRequestTest.php b/tests/Integration/Requests/AuthRequestTest.php index 6c5c2cd..8780c51 100644 --- a/tests/Integration/Requests/AuthRequestTest.php +++ b/tests/Integration/Requests/AuthRequestTest.php @@ -38,11 +38,14 @@ public function testAuthWithSessionCookie(): void $this->assertNotNull($cookie); // clear config - CTConfig::clearConfig(); - CTConfig::setApiUrl(IntegrationTestData::get()->getApiUrl()); + CTConfig::clearCookies(); // verify that we are not logged in now - $this->assertNull(CTConfig::getSessionCookieString()); + CTConfig::setApiUrl(IntegrationTestData::get()->getApiUrl()); + $this->assertFalse(CTConfig::validateAuthentication()); + + // clear again + CTConfig::clearCookies(); // login using the cookie $auth = CTConfig::authWithSessionCookie($cookie); @@ -55,6 +58,7 @@ public function testAuthWithSessionCookie(): void // confirm the session cookie was updated (but not replaced) $updatedCookie = CTConfig::getSessionCookieString(); + $this->assertNotNull($updatedCookie); $this->assertSame(explode(';', $cookie, 2)[0], explode(';', $updatedCookie, 2)[0]); }