source: trunk/tests/DBSessionHandlerTest.php @ 136

Last change on this file since 136 was 136, checked in by scdev, 18 years ago

Q - Merged branches/2.0singleton into trunk. Completed updating classes to use singleton methods. Implemented tests. Fixed some bugs. Changed some interfaces.

File size: 1.7 KB
Line 
1<?php
2/**
3 * PHPUnit test case for DBSessionHandler
4 *
5 * The method skeletons below need to be filled in with
6 * real data so that the tests will run correctly. Replace
7 * all EXPECTED_VAL and PARAM strings with real data.
8 *
9 * Created with PHPUnit_Skeleton on 2005-08-09
10 */
11require_once 'PHPUnit.php';
12class DBSessionHandlerTest extends PHPUnit_TestCase {
13
14    var $DBSessionHandler;
15
16    function DBSessionHandlerTest($name)
17    {
18        $this->PHPUnit_TestCase($name);
19    }
20
21    function setUp()
22    {
23        require dirname(__FILE__) . '/_config.inc.php';
24        require_once '../lib/DBSessionHandler.inc.php';
25        session_write_close();
26        $this->DBSessionHandler = new DBSessionHandler($app->db, array(
27            'db_table' => 'session_tbl',
28            'create_table' => true,
29        ));
30    }
31
32    function tearDown()
33    {
34        unset($this->DBSessionHandler);
35    }
36
37    function test_DBsessionopen()
38    {
39        $this->DBSessionHandler->DBsessionopen('', '');
40    }
41
42    function test_DBsessionclose()
43    {
44        $this->DBSessionHandler->DBsessionclose();
45    }
46
47    function test_DBsessionread()
48    {
49        $this->DBSessionHandler->DBsessionread(session_id());
50    }
51
52    function test_DBsessionwrite()
53    {
54        $this->DBSessionHandler->DBsessionwrite(session_id(), serialize($_SESSION));
55    }
56
57    function test_DBsessiondestroy()
58    {
59        $this->DBSessionHandler->DBsessiondestroy(session_id());
60    }
61
62    function test_DBsessiongarbage()
63    {
64        $this->DBSessionHandler->DBsessiongarbage(0);
65    }
66
67}
68// Running the test.
69$suite = new PHPUnit_TestSuite('DBSessionHandlerTest');
70$result = PHPUnit::run($suite);
71echo $result->toString();
72?>
Note: See TracBrowser for help on using the repository browser.