3 defined('AK_TEST_DATABASE_ON') ?
null : define('AK_TEST_DATABASE_ON', true);
4 require_once(dirname(__FILE__
).'/../../fixtures/config/config.php');
7 require_once(AK_LIB_DIR
.DS
.'AkDbSession.php');
10 * In order to test sessions we have created a help script that we will use for checking and setting session params
15 class Test_of_AkDbSession_Class
extends WebTestCase
17 var $sessionLife = NULL;
21 $this->_test_script
= str_replace('/fixtures/public','',trim(AK_TESTING_URL
,'/')).
22 '/mocks/test_script_AkDbSession.php';
27 $browser =& $this->getBrowser();
28 $this->get("$this->_test_script?open_check=1");
29 $expected_session_id = $browser->getContentAsText();
30 $this->get("$this->_test_script?open_check=1");
31 //$browser->getContentAsText();
33 $this->assertWantedText($expected_session_id,'Sessions are not working correctly');
36 function Test_read_write()
38 $expected = 'test_value';
39 $this->get("$this->_test_script?key=test_key&value=$expected");
40 $this->get("$this->_test_script?key=test_key");
41 $this->assertWantedText($expected,'Session is not storing values on database correctly when calling '.
42 $this->_test_script
.'?key=test_key');
45 function Test_destroy()
47 $expected = 'value not found';
48 $this->get("$this->_test_script?key=test_key&value=test_value");
49 $this->get("$this->_test_script?destroy_check=1");
50 $this->get("$this->_test_script?key=test_key");
51 $this->assertWantedText($expected,'session_destroy(); is not working as expected');
56 $expected = 'value not found';
58 $copy->get("$this->_test_script?key=test_key&value=test_value&expire=1");
61 $this->get("$this->_test_script?dumb_call_for_activating_gc");
63 $copy->get("$this->_test_script?key=test_key");
64 $this->assertWantedText($expected,'Session garbage collection is not working correctly');
68 ak_test('Test_of_AkDbSession_Class', true);