Skip to content

Commit 1441834

Browse files
committed
test cases updated for new model
1 parent 0f1ff31 commit 1441834

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

test/csrfprotector_test.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testRefreshToken()
8787

8888
$this->assertTrue(csrfP_wrapper::checkHeader('Set-Cookie'));
8989
$this->assertTrue(csrfP_wrapper::checkHeader('csrfp_token'));
90-
$this->assertTrue(csrfp_wrapper::checkHeader($_SESSION[csrfprotector::$config['CSRFP_TOKEN']]));
90+
$this->assertTrue(csrfp_wrapper::checkHeader($_SESSION[csrfprotector::$config['CSRFP_TOKEN']][1]));
9191
}
9292

9393

@@ -253,17 +253,11 @@ public function testAuthorisePost_success()
253253
$_POST[csrfprotector::$config['CSRFP_TOKEN']] = $_GET[csrfprotector::$config['CSRFP_TOKEN']] = $_SESSION[csrfprotector::$config['CSRFP_TOKEN']];
254254
$temp = $_SESSION[csrfprotector::$config['CSRFP_TOKEN']];
255255

256-
$temp_elem_count = count($temp);
257-
$temp_elems = array();
258-
foreach ($temp as $value) {
259-
array_push($temp_elems, $value);
260-
}
261-
262256
csrfprotector::authorizePost(); //will create new session and cookies
263257
$this->assertFalse($temp_elems == $_SESSION[csrfprotector::$config['CSRFP_TOKEN']][0]);
264258
$this->assertTrue(csrfp_wrapper::checkHeader('Set-Cookie'));
265259
$this->assertTrue(csrfp_wrapper::checkHeader('csrfp_token'));
266-
$this->assertTrue(csrfp_wrapper::checkHeader($_SESSION[csrfprotector::$config['CSRFP_TOKEN']])); // Combine these 3 later
260+
$this->assertTrue(csrfp_wrapper::checkHeader($_SESSION[csrfprotector::$config['CSRFP_TOKEN']][0])); // Combine these 3 later
267261

268262
// For get method
269263
$_SERVER['REQUEST_METHOD'] = 'GET';
@@ -272,11 +266,10 @@ public function testAuthorisePost_success()
272266
$temp = $_SESSION[csrfprotector::$config['CSRFP_TOKEN']];
273267

274268
csrfprotector::authorizePost(); //will create new session and cookies
275-
276269
$this->assertFalse($temp == $_SESSION[csrfprotector::$config['CSRFP_TOKEN']]);
277270
$this->assertTrue(csrfp_wrapper::checkHeader('Set-Cookie'));
278271
$this->assertTrue(csrfp_wrapper::checkHeader('csrfp_token'));
279-
$this->assertTrue(csrfp_wrapper::checkHeader($_SESSION[csrfprotector::$config['CSRFP_TOKEN']])); // Combine these 3 later
272+
$this->assertTrue(csrfp_wrapper::checkHeader($_SESSION[csrfprotector::$config['CSRFP_TOKEN']][0])); // Combine these 3 later
280273
}
281274

282275
/**

0 commit comments

Comments
 (0)