CakeSessionTest.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. <?php
  2. /**
  3. * SessionTest file
  4. *
  5. * PHP 5
  6. *
  7. * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
  8. * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The MIT License
  11. * Redistributions of files must retain the above copyright notice
  12. *
  13. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  14. * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
  15. * @package cake.tests.cases.libs
  16. * @since CakePHP(tm) v 1.2.0.4206
  17. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  18. */
  19. App::uses('CakeSession', 'Model/Datasource');
  20. class TestCakeSession extends CakeSession {
  21. public static function setUserAgent($value) {
  22. self::$_userAgent = $value;
  23. }
  24. public static function setHost($host) {
  25. self::_setHost($host);
  26. }
  27. }
  28. /**
  29. * CakeSessionTest class
  30. *
  31. * @package cake.tests.cases.libs
  32. */
  33. class CakeSessionTest extends CakeTestCase {
  34. protected static $_gcDivisor;
  35. /**
  36. * Fixtures used in the SessionTest
  37. *
  38. * @var array
  39. * @access public
  40. */
  41. public $fixtures = array('core.session');
  42. /**
  43. * setup before class.
  44. *
  45. * @access public
  46. * @return void
  47. */
  48. public static function setupBeforeClass() {
  49. // Make sure garbage colector will be called
  50. self::$_gcDivisor = ini_get('session.gc_divisor');
  51. ini_set('session.gc_divisor', '1');
  52. }
  53. /**
  54. * teardown after class
  55. *
  56. * @access public
  57. * @return void
  58. */
  59. public static function teardownAfterClass() {
  60. // Revert to the default setting
  61. ini_set('session.gc_divisor', self::$_gcDivisor);
  62. }
  63. /**
  64. * setUp method
  65. *
  66. * @access public
  67. * @return void
  68. */
  69. public function setup() {
  70. parent::setup();
  71. Configure::write('Session', array(
  72. 'defaults' => 'php',
  73. 'cookie' => 'cakephp',
  74. 'timeout' => 120,
  75. 'cookieTimeout' => 120,
  76. 'ini' => array(),
  77. ));
  78. TestCakeSession::init();
  79. }
  80. /**
  81. * tearDown method
  82. *
  83. * @access public
  84. * @return void
  85. */
  86. public function teardown() {
  87. if (TestCakeSession::started()) {
  88. TestCakeSession::clear();
  89. }
  90. unset($_SESSION);
  91. parent::teardown();
  92. }
  93. /**
  94. * test setting ini properties with Session configuration.
  95. *
  96. * @return void
  97. */
  98. public function testSessionConfigIniSetting() {
  99. $_SESSION = null;
  100. Configure::write('Session', array(
  101. 'cookie' => 'test',
  102. 'checkAgent' => false,
  103. 'timeout' => 86400,
  104. 'ini' => array(
  105. 'session.referer_check' => 'example.com',
  106. 'session.use_trans_sid' => false
  107. )
  108. ));
  109. TestCakeSession::start();
  110. $this->assertEquals('', ini_get('session.use_trans_sid'), 'Ini value is incorrect');
  111. $this->assertEquals('example.com', ini_get('session.referer_check'), 'Ini value is incorrect');
  112. $this->assertEquals('test', ini_get('session.name'), 'Ini value is incorrect');
  113. }
  114. /**
  115. * testSessionPath
  116. *
  117. * @access public
  118. * @return void
  119. */
  120. public function testSessionPath() {
  121. TestCakeSession::init('/index.php');
  122. $this->assertEquals(TestCakeSession::$path, '/');
  123. TestCakeSession::init('/sub_dir/index.php');
  124. $this->assertEquals(TestCakeSession::$path, '/sub_dir/');
  125. }
  126. /**
  127. * testCakeSessionPathEmpty
  128. *
  129. * @access public
  130. * @return void
  131. */
  132. public function testCakeSessionPathEmpty() {
  133. TestCakeSession::init('');
  134. $this->assertEquals(TestCakeSession::$path, '/', 'Session path is empty, with "" as $base needs to be /');
  135. }
  136. /**
  137. * testCakeSessionPathContainsParams
  138. *
  139. * @access public
  140. * @return void
  141. */
  142. public function testCakeSessionPathContainsQuestion() {
  143. TestCakeSession::init('/index.php?');
  144. $this->assertEquals(TestCakeSession::$path, '/');
  145. }
  146. /**
  147. * testSetHost
  148. *
  149. * @access public
  150. * @return void
  151. */
  152. public function testSetHost() {
  153. TestCakeSession::init();
  154. TestCakeSession::setHost('cakephp.org');
  155. $this->assertEquals(TestCakeSession::$host, 'cakephp.org');
  156. }
  157. /**
  158. * testSetHostWithPort
  159. *
  160. * @access public
  161. * @return void
  162. */
  163. public function testSetHostWithPort() {
  164. TestCakeSession::init();
  165. TestCakeSession::setHost('cakephp.org:443');
  166. $this->assertEquals(TestCakeSession::$host, 'cakephp.org');
  167. }
  168. /**
  169. * test valid with bogus user agent.
  170. *
  171. * @return void
  172. */
  173. public function testValidBogusUserAgent() {
  174. Configure::write('Session.checkAgent', true);
  175. TestCakeSession::start();
  176. $this->assertTrue(TestCakeSession::valid(), 'Newly started session should be valid');
  177. TestCakeSession::userAgent('bogus!');
  178. $this->assertFalse(TestCakeSession::valid(), 'user agent mismatch should fail.');
  179. }
  180. /**
  181. * test valid with bogus user agent.
  182. *
  183. * @return void
  184. */
  185. public function testValidTimeExpiry() {
  186. Configure::write('Session.checkAgent', true);
  187. TestCakeSession::start();
  188. $this->assertTrue(TestCakeSession::valid(), 'Newly started session should be valid');
  189. TestCakeSession::$time = strtotime('next year');
  190. $this->assertFalse(TestCakeSession::valid(), 'time should cause failure.');
  191. }
  192. /**
  193. * testCheck method
  194. *
  195. * @access public
  196. * @return void
  197. */
  198. public function testCheck() {
  199. TestCakeSession::write('SessionTestCase', 'value');
  200. $this->assertTrue(TestCakeSession::check('SessionTestCase'));
  201. $this->assertFalse(TestCakeSession::check('NotExistingSessionTestCase'), false);
  202. }
  203. /**
  204. * testSimpleRead method
  205. *
  206. * @access public
  207. * @return void
  208. */
  209. public function testSimpleRead() {
  210. TestCakeSession::write('testing', '1,2,3');
  211. $result = TestCakeSession::read('testing');
  212. $this->assertEquals('1,2,3', $result);
  213. TestCakeSession::write('testing', array('1' => 'one', '2' => 'two','3' => 'three'));
  214. $result = TestCakeSession::read('testing.1');
  215. $this->assertEquals('one', $result);
  216. $result = TestCakeSession::read('testing');
  217. $this->assertEquals(array('1' => 'one', '2' => 'two', '3' => 'three'), $result);
  218. $result = TestCakeSession::read();
  219. $this->assertTrue(isset($result['testing']));
  220. $this->assertTrue(isset($result['Config']));
  221. $this->assertTrue(isset($result['Config']['userAgent']));
  222. TestCakeSession::write('This.is.a.deep.array.my.friend', 'value');
  223. $result = TestCakeSession::read('This.is.a.deep.array.my.friend');
  224. $this->assertEquals($result, 'value');
  225. }
  226. /**
  227. * testReadyEmpty
  228. *
  229. * @return void
  230. * @access public
  231. */
  232. public function testReadyEmpty() {
  233. $this->assertFalse(TestCakeSession::read(''));
  234. }
  235. /**
  236. * test writing a hash of values/
  237. *
  238. * @return void
  239. * @access public
  240. */
  241. public function testWriteArray() {
  242. $result = TestCakeSession::write(array(
  243. 'one' => 1,
  244. 'two' => 2,
  245. 'three' => array('something'),
  246. 'null' => null
  247. ));
  248. $this->assertTrue($result);
  249. $this->assertEquals(1, TestCakeSession::read('one'));
  250. $this->assertEquals(array('something'), TestCakeSession::read('three'));
  251. $this->assertEquals(null, TestCakeSession::read('null'));
  252. }
  253. /**
  254. * testWriteEmptyKey
  255. *
  256. * @return void
  257. * @access public
  258. */
  259. public function testWriteEmptyKey() {
  260. $this->assertFalse(TestCakeSession::write('', 'graham'));
  261. $this->assertFalse(TestCakeSession::write('', ''));
  262. $this->assertFalse(TestCakeSession::write(''));
  263. }
  264. /**
  265. * testId method
  266. *
  267. * @access public
  268. * @return void
  269. */
  270. public function testId() {
  271. TestCakeSession::destroy();
  272. $result = TestCakeSession::id();
  273. $expected = session_id();
  274. $this->assertEquals($expected, $result);
  275. TestCakeSession::id('MySessionId');
  276. $result = TestCakeSession::id();
  277. $this->assertEquals('MySessionId', $result);
  278. }
  279. /**
  280. * testStarted method
  281. *
  282. * @access public
  283. * @return void
  284. */
  285. public function testStarted() {
  286. unset($_SESSION);
  287. $_SESSION = null;
  288. $this->assertFalse(TestCakeSession::started());
  289. $this->assertTrue(TestCakeSession::start());
  290. $this->assertTrue(TestCakeSession::started());
  291. }
  292. /**
  293. * testError method
  294. *
  295. * @access public
  296. * @return void
  297. */
  298. public function testError() {
  299. TestCakeSession::read('Does.not.exist');
  300. $result = TestCakeSession::error();
  301. $this->assertEquals("Does.not.exist doesn't exist", $result);
  302. TestCakeSession::delete('Failing.delete');
  303. $result = TestCakeSession::error();
  304. $this->assertEquals("Failing.delete doesn't exist", $result);
  305. }
  306. /**
  307. * testDel method
  308. *
  309. * @access public
  310. * @return void
  311. */
  312. public function testDelete() {
  313. $this->assertTrue(TestCakeSession::write('Delete.me', 'Clearing out'));
  314. $this->assertTrue(TestCakeSession::delete('Delete.me'));
  315. $this->assertFalse(TestCakeSession::check('Delete.me'));
  316. $this->assertTrue(TestCakeSession::check('Delete'));
  317. $this->assertTrue(TestCakeSession::write('Clearing.sale', 'everything must go'));
  318. $this->assertTrue(TestCakeSession::delete('Clearing'));
  319. $this->assertFalse(TestCakeSession::check('Clearing.sale'));
  320. $this->assertFalse(TestCakeSession::check('Clearing'));
  321. }
  322. /**
  323. * testDestroy method
  324. *
  325. * @access public
  326. * @return void
  327. */
  328. public function testDestroy() {
  329. TestCakeSession::write('bulletProof', 'invicible');
  330. $id = TestCakeSession::id();
  331. TestCakeSession::destroy();
  332. $this->assertFalse(TestCakeSession::check('bulletProof'));
  333. $this->assertNotEqual($id, TestCakeSession::id());
  334. }
  335. /**
  336. * testCheckingSavedEmpty method
  337. *
  338. * @access public
  339. * @return void
  340. */
  341. public function testCheckingSavedEmpty() {
  342. $this->assertTrue(TestCakeSession::write('SessionTestCase', 0));
  343. $this->assertTrue(TestCakeSession::check('SessionTestCase'));
  344. $this->assertTrue(TestCakeSession::write('SessionTestCase', '0'));
  345. $this->assertTrue(TestCakeSession::check('SessionTestCase'));
  346. $this->assertTrue(TestCakeSession::write('SessionTestCase', false));
  347. $this->assertTrue(TestCakeSession::check('SessionTestCase'));
  348. $this->assertTrue(TestCakeSession::write('SessionTestCase', null));
  349. $this->assertFalse(TestCakeSession::check('SessionTestCase'));
  350. }
  351. /**
  352. * testCheckKeyWithSpaces method
  353. *
  354. * @access public
  355. * @return void
  356. */
  357. public function testCheckKeyWithSpaces() {
  358. $this->assertTrue(TestCakeSession::write('Session Test', "test"));
  359. $this->assertEquals('test', TestCakeSession::check('Session Test'));
  360. TestCakeSession::delete('Session Test');
  361. $this->assertTrue(TestCakeSession::write('Session Test.Test Case', "test"));
  362. $this->assertTrue(TestCakeSession::check('Session Test.Test Case'));
  363. }
  364. /**
  365. * testCheckEmpty
  366. *
  367. * @access public
  368. * @return void
  369. */
  370. public function testCheckEmpty() {
  371. $this->assertFalse(TestCakeSession::check());
  372. }
  373. /**
  374. * test key exploitation
  375. *
  376. * @return void
  377. */
  378. public function testKeyExploit() {
  379. $key = "a'] = 1; phpinfo(); \$_SESSION['a";
  380. $result = TestCakeSession::write($key, 'haxored');
  381. $this->assertTrue($result);
  382. $result = TestCakeSession::read($key);
  383. $this->assertEquals('haxored', $result);
  384. }
  385. /**
  386. * testReadingSavedEmpty method
  387. *
  388. * @access public
  389. * @return void
  390. */
  391. public function testReadingSavedEmpty() {
  392. TestCakeSession::write('SessionTestCase', 0);
  393. $this->assertEquals(0, TestCakeSession::read('SessionTestCase'));
  394. TestCakeSession::write('SessionTestCase', '0');
  395. $this->assertEquals('0', TestCakeSession::read('SessionTestCase'));
  396. $this->assertFalse(TestCakeSession::read('SessionTestCase') === 0);
  397. TestCakeSession::write('SessionTestCase', false);
  398. $this->assertFalse(TestCakeSession::read('SessionTestCase'));
  399. TestCakeSession::write('SessionTestCase', null);
  400. $this->assertEquals(null, TestCakeSession::read('SessionTestCase'));
  401. }
  402. /**
  403. * testCheckUserAgentFalse method
  404. *
  405. * @access public
  406. * @return void
  407. */
  408. public function testCheckUserAgentFalse() {
  409. Configure::write('Session.checkAgent', false);
  410. TestCakeSession::setUserAgent(md5('http://randomdomainname.com' . Configure::read('Security.salt')));
  411. $this->assertTrue(TestCakeSession::valid());
  412. }
  413. /**
  414. * testCheckUserAgentTrue method
  415. *
  416. * @access public
  417. * @return void
  418. */
  419. public function testCheckUserAgentTrue() {
  420. Configure::write('Session.checkAgent', true);
  421. TestCakeSession::$error = false;
  422. $agent = md5('http://randomdomainname.com' . Configure::read('Security.salt'));
  423. TestCakeSession::write('Config.userAgent', md5('Hacking you!'));
  424. TestCakeSession::setUserAgent($agent);
  425. $this->assertFalse(TestCakeSession::valid());
  426. }
  427. /**
  428. * testReadAndWriteWithDatabaseStorage method
  429. *
  430. * @access public
  431. * @return void
  432. */
  433. public function testReadAndWriteWithCakeStorage() {
  434. Configure::write('Session.defaults', 'cake');
  435. TestCakeSession::init();
  436. TestCakeSession::start();
  437. TestCakeSession::write('SessionTestCase', 0);
  438. $this->assertEquals(0, TestCakeSession::read('SessionTestCase'));
  439. TestCakeSession::write('SessionTestCase', '0');
  440. $this->assertEquals('0', TestCakeSession::read('SessionTestCase'));
  441. $this->assertFalse(TestCakeSession::read('SessionTestCase') === 0);
  442. TestCakeSession::write('SessionTestCase', false);
  443. $this->assertFalse(TestCakeSession::read('SessionTestCase'));
  444. TestCakeSession::write('SessionTestCase', null);
  445. $this->assertEquals(null, TestCakeSession::read('SessionTestCase'));
  446. TestCakeSession::write('SessionTestCase', 'This is a Test');
  447. $this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase'));
  448. TestCakeSession::write('SessionTestCase', 'This is a Test');
  449. TestCakeSession::write('SessionTestCase', 'This was updated');
  450. $this->assertEquals('This was updated', TestCakeSession::read('SessionTestCase'));
  451. TestCakeSession::destroy();
  452. $this->assertNull(TestCakeSession::read('SessionTestCase'));
  453. }
  454. /**
  455. * test using a handler from app/Model/Datasource/Session.
  456. *
  457. * @return void
  458. */
  459. public function testUsingAppLibsHandler() {
  460. App::build(array(
  461. 'Model/Datasource/Session' => array(
  462. CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS . 'Session' . DS
  463. ),
  464. 'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
  465. ), true);
  466. Configure::write('Session', array(
  467. 'defaults' => 'cake',
  468. 'handler' => array(
  469. 'engine' => 'TestAppLibSession'
  470. )
  471. ));
  472. TestCakeSession::destroy();
  473. $this->assertTrue(TestCakeSession::started());
  474. App::build();
  475. }
  476. /**
  477. * test using a handler from a plugin.
  478. *
  479. * @return void
  480. */
  481. public function testUsingPluginHandler() {
  482. App::build(array(
  483. 'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
  484. ), true);
  485. Configure::write('Session', array(
  486. 'defaults' => 'cake',
  487. 'handler' => array(
  488. 'engine' => 'TestPlugin.TestPluginSession'
  489. )
  490. ));
  491. TestCakeSession::destroy();
  492. $this->assertTrue(TestCakeSession::started());
  493. App::build();
  494. }
  495. /**
  496. * testReadAndWriteWithDatabaseStorage method
  497. *
  498. * @access public
  499. * @return void
  500. */
  501. public function testReadAndWriteWithCacheStorage() {
  502. Configure::write('Session.defaults', 'cache');
  503. TestCakeSession::init();
  504. TestCakeSession::destroy();
  505. TestCakeSession::write('SessionTestCase', 0);
  506. $this->assertEquals(0, TestCakeSession::read('SessionTestCase'));
  507. TestCakeSession::write('SessionTestCase', '0');
  508. $this->assertEquals('0', TestCakeSession::read('SessionTestCase'));
  509. $this->assertFalse(TestCakeSession::read('SessionTestCase') === 0);
  510. TestCakeSession::write('SessionTestCase', false);
  511. $this->assertFalse(TestCakeSession::read('SessionTestCase'));
  512. TestCakeSession::write('SessionTestCase', null);
  513. $this->assertEquals(null, TestCakeSession::read('SessionTestCase'));
  514. TestCakeSession::write('SessionTestCase', 'This is a Test');
  515. $this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase'));
  516. TestCakeSession::write('SessionTestCase', 'This is a Test');
  517. TestCakeSession::write('SessionTestCase', 'This was updated');
  518. $this->assertEquals('This was updated', TestCakeSession::read('SessionTestCase'));
  519. TestCakeSession::destroy();
  520. $this->assertNull(TestCakeSession::read('SessionTestCase'));
  521. }
  522. /**
  523. * test that changing the config name of the cache config works.
  524. *
  525. * @return void
  526. */
  527. public function testReadAndWriteWithCustomCacheConfig() {
  528. Configure::write('Session.defaults', 'cache');
  529. Configure::write('Session.handler.config', 'session_test');
  530. Cache::config('session_test', array(
  531. 'engine' => 'File',
  532. 'prefix' => 'session_test_',
  533. ));
  534. TestCakeSession::init();
  535. TestCakeSession::start();
  536. TestCakeSession::write('SessionTestCase', 'Some value');
  537. $this->assertEquals('Some value', TestCakeSession::read('SessionTestCase'));
  538. $id = TestCakeSession::id();
  539. Cache::delete($id, 'session_test');
  540. }
  541. /**
  542. * testReadAndWriteWithDatabaseStorage method
  543. *
  544. * @access public
  545. * @return void
  546. */
  547. public function testReadAndWriteWithDatabaseStorage() {
  548. Configure::write('Session.defaults', 'database');
  549. Configure::write('Session.handler.table', 'sessions');
  550. Configure::write('Session.handler.model', 'Session');
  551. Configure::write('Session.handler.database', 'test');
  552. TestCakeSession::init();
  553. TestCakeSession::start();
  554. TestCakeSession::write('SessionTestCase', 0);
  555. $this->assertEquals(0, TestCakeSession::read('SessionTestCase'));
  556. TestCakeSession::write('SessionTestCase', '0');
  557. $this->assertEquals('0', TestCakeSession::read('SessionTestCase'));
  558. $this->assertFalse(TestCakeSession::read('SessionTestCase') === 0);
  559. TestCakeSession::write('SessionTestCase', false);
  560. $this->assertFalse(TestCakeSession::read('SessionTestCase'));
  561. TestCakeSession::write('SessionTestCase', null);
  562. $this->assertEquals(null, TestCakeSession::read('SessionTestCase'));
  563. TestCakeSession::write('SessionTestCase', 'This is a Test');
  564. $this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase'));
  565. TestCakeSession::write('SessionTestCase', 'Some additional data');
  566. $this->assertEquals('Some additional data', TestCakeSession::read('SessionTestCase'));
  567. TestCakeSession::destroy();
  568. $this->assertNull(TestCakeSession::read('SessionTestCase'));
  569. Configure::write('Session', array(
  570. 'defaults' => 'php'
  571. ));
  572. TestCakeSession::init();
  573. }
  574. /**
  575. * testSessionTimeout method
  576. *
  577. * @access public
  578. * @return void
  579. */
  580. public function testSessionTimeout() {
  581. Configure::write('debug', 2);
  582. Configure::write('Session.autoRegenerate', false);
  583. $timeoutSeconds = Configure::read('Session.timeout') * 60;
  584. TestCakeSession::destroy();
  585. TestCakeSession::write('Test', 'some value');
  586. $this->assertEquals(time() + $timeoutSeconds, CakeSession::$sessionTime);
  587. $this->assertEquals(10, $_SESSION['Config']['countdown']);
  588. $this->assertEquals(CakeSession::$sessionTime, $_SESSION['Config']['time']);
  589. $this->assertEquals(time(), CakeSession::$time);
  590. $this->assertEquals(time() + $timeoutSeconds, $_SESSION['Config']['time']);
  591. Configure::write('Session.harden', true);
  592. TestCakeSession::destroy();
  593. TestCakeSession::write('Test', 'some value');
  594. $this->assertEquals(time() + $timeoutSeconds, CakeSession::$sessionTime);
  595. $this->assertEquals(10, $_SESSION['Config']['countdown']);
  596. $this->assertEquals(CakeSession::$sessionTime, $_SESSION['Config']['time']);
  597. $this->assertEquals(time(), CakeSession::$time);
  598. $this->assertEquals(CakeSession::$time + $timeoutSeconds, $_SESSION['Config']['time']);
  599. }
  600. }