source: trunk/tests/DBSessionHandlerTest.php @ 1

Last change on this file since 1 was 1, checked in by scdev, 19 years ago

Initial import.

File size: 2.0 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);
27        $this->DBSessionHandler = new DBSessionHandler(null, array(
28            'db_server' => $app->getParam('db_server'),
29            'db_name' => $app->getParam('db_name'),
30            'db_user' => $app->getParam('db_user'),
31            'db_pass' => $app->getParam('db_pass'),
32            'db_always_debug' => $app->getParam('db_always_debug'),
33            'db_debug' => $app->getParam('db_debug'),
34            'db_die_on_failure' => $app->getParam('db_die_on_failure'),
35        ));
36    }
37
38    function tearDown()
39    {
40        unset($this->DBSessionHandler);
41    }
42
43    function test_DBsessionopen()
44    {
45        $this->DBSessionHandler->DBsessionopen('', '');
46    }
47
48    function test_DBsessionclose()
49    {
50        $this->DBSessionHandler->DBsessionclose();
51    }
52
53    function test_DBsessionread()
54    {
55        $this->DBSessionHandler->DBsessionread(session_id());
56    }
57
58    function test_DBsessionwrite()
59    {
60        $this->DBSessionHandler->DBsessionwrite(session_id(), serialize($_SESSION));
61    }
62
63    function test_DBsessiondestroy()
64    {
65        $this->DBSessionHandler->DBsessiondestroy(session_id());
66    }
67
68    function test_DBsessiongarbage()
69    {
70        $this->DBSessionHandler->DBsessiongarbage(0);
71    }
72
73}
74// Running the test.
75$suite = new PHPUnit_TestSuite('DBSessionHandlerTest');
76$result = PHPUnit::run($suite);
77echo $result->toString();
78?>
Note: See TracBrowser for help on using the repository browser.