source: tags/2.1.5/tests/DBSessionHandlerTest.php @ 377

Last change on this file since 377 was 377, checked in by quinn, 14 years ago

Releasing trunk as stable version 2.1.5

File size: 2.6 KB
Line 
1<?php
2/**
3 * The Strangecode Codebase - a general application development framework for PHP
4 * For details visit the project site: <http://trac.strangecode.com/codebase/>
5 * Copyright 2001-2010 Strangecode, LLC
6 *
7 * This file is part of The Strangecode Codebase.
8 *
9 * The Strangecode Codebase is free software: you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your option)
12 * any later version.
13 *
14 * The Strangecode Codebase is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/**
24 * PHPUnit test case for codebase/lib/DBSessionHandler.inc.php
25 *
26 * The method skeletons below need to be filled in with
27 * real data so that the tests will run correctly. Replace
28 * all EXPECTED_VAL and PARAM strings with real data.
29 *
30 * Created with PHPUnit_Skeleton on 2005-08-09
31 */
32require_once 'PHPUnit.php';
33class DBSessionHandlerTest extends PHPUnit_TestCase {
34
35    var $DBSessionHandler;
36
37    function DBSessionHandlerTest($name)
38    {
39        $this->PHPUnit_TestCase($name);
40    }
41
42    function setUp()
43    {
44        require dirname(__FILE__) . '/_config.inc.php';
45        require_once '../lib/DBSessionHandler.inc.php';
46        session_write_close();
47        $this->DBSessionHandler = new DBSessionHandler($app->db, array(
48            'db_table' => 'session_tbl',
49            'create_table' => true,
50        ));
51    }
52
53    function tearDown()
54    {
55        unset($this->DBSessionHandler);
56    }
57
58    function test_DBsessionopen()
59    {
60        $this->DBSessionHandler->DBsessionopen('', '');
61    }
62
63    function test_DBsessionclose()
64    {
65        $this->DBSessionHandler->DBsessionclose();
66    }
67
68    function test_DBsessionread()
69    {
70        $this->DBSessionHandler->DBsessionread(session_id());
71    }
72
73    function test_DBsessionwrite()
74    {
75        $this->DBSessionHandler->DBsessionwrite(session_id(), serialize($_SESSION));
76    }
77
78    function test_DBsessiondestroy()
79    {
80        $this->DBSessionHandler->DBsessiondestroy(session_id());
81    }
82
83    function test_DBsessiongarbage()
84    {
85        $this->DBSessionHandler->DBsessiongarbage(0);
86    }
87
88}
89// Running the test.
90$suite = new PHPUnit_TestSuite('DBSessionHandlerTest');
91$result = PHPUnit::run($suite);
92echo $result->toString();
93?>
Note: See TracBrowser for help on using the repository browser.