about summary refs log tree commit diff stats
path: root/tests_integration/LogoutHandlerTest.php
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-05-27 21:43:15 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-05-27 21:43:15 +0300
commit03d1c9a1f0bd65cd7fb64a9bcb1c8c8a8961ff8e (patch)
treeefb792b888653d7fdb9e63c2699cd90fa80e339a /tests_integration/LogoutHandlerTest.php
parent37f9ded993c7f01293167a705bffea1a7c8fa1d6 (diff)
downloadthe-epube-03d1c9a1f0bd65cd7fb64a9bcb1c8c8a8961ff8e.tar.gz
the-epube-03d1c9a1f0bd65cd7fb64a9bcb1c8c8a8961ff8e.tar.xz
remove unnecessary csrf token testing / local vars
Diffstat (limited to 'tests_integration/LogoutHandlerTest.php')
-rw-r--r--tests_integration/LogoutHandlerTest.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests_integration/LogoutHandlerTest.php b/tests_integration/LogoutHandlerTest.php
index 35289f2..3eff109 100644
--- a/tests_integration/LogoutHandlerTest.php
+++ b/tests_integration/LogoutHandlerTest.php
@@ -16,13 +16,12 @@ final class LogoutHandlerTest extends ApiTestCase
 
 		$this->assertEquals(200, $status);
 		$this->assertEquals('ok', $body['result'] ?? null);
-		$csrfToken = $body['csrf_token'] ?? null;
-		$this->assertNotNull($csrfToken);
+		$this->assertNotNull($body['csrf_token']);
 
 		// Step 2: Logout
 		[$status, $body] = $this->post($this->apiUrl, [
 			'op' => 'logout',
-		], $csrfToken);
+		]);
 
 		$this->assertEquals(200, $status);
 		$this->assertEquals('ok', $body['result'] ?? null);
@@ -39,12 +38,12 @@ final class LogoutHandlerTest extends ApiTestCase
 			'password' => 'test',
 		]);
 		$this->assertEquals(200, $status);
-		$csrfToken = $body['csrf_token'] ?? null;
+		$this->assertNotNull($body['csrf_token']);
 
 		// Step 2: Logout
 		$this->post($this->apiUrl, [
 			'op' => 'logout',
-		], $csrfToken);
+		]);
 
 		// Step 3: Try an auth-required operation → should be 401
 		[$status, $body] = $this->post($this->apiUrl, [
@@ -76,12 +75,13 @@ final class LogoutHandlerTest extends ApiTestCase
 			'user'     => 'test',
 			'password' => 'test',
 		]);
-		$csrfToken = $body['csrf_token'] ?? null;
+
+		$this->assertNotNull($body['csrf_token']);
 
 		// First logout
 		[$status1, $body1] = $this->post($this->apiUrl, [
 			'op' => 'logout',
-		], $csrfToken);
+		]);
 
 		$this->assertEquals(200, $status1);
 		$this->assertEquals('ok', $body1['result'] ?? null);
@@ -89,7 +89,7 @@ final class LogoutHandlerTest extends ApiTestCase
 		// Second logout — session already destroyed → 401
 		[$status2, $body2] = $this->post($this->apiUrl, [
 			'op' => 'logout',
-		], $csrfToken);
+		]);
 
 		$this->assertEquals(401, $status2);
 	}