source: trunk/tests/DBSessionHandlerTest.php

Last change on this file was 468, checked in by anonymous, 10 years ago

Completed integrating /branches/eli_branch into /trunk. Changes include:

  • Removed closing ?> from end of files
  • Upgrade old-style contructor methods to use construct() instead.
  • Class properties and methods defined as public, private, static or protected
  • Ensure code runs under E_ALL with only mysql_* deprecated warnings
  • Search for the '@' symbol anywhere it might be used to supress runtime errors, then replace with proper error recovery.
  • Run the php cli -l option to check files for syntax errors.
  • Bring tests up-to-date with latest version and methods of PHPUnit
File size: 2.4 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-2012 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 */
32
33class DBSessionHandlerTest extends PHPUnit_Framework_TestCase {
34
35    var $DBSessionHandler;
36
37    function setUp()
38    {
39        require dirname(__FILE__) . '/_config.inc.php';
40        require_once '../lib/DBSessionHandler.inc.php';
41        session_write_close();
42        $this->DBSessionHandler = new DBSessionHandler($app->db, array(
43            'db_table' => 'session_tbl',
44            'create_table' => true,
45        ));
46    }
47
48    function tearDown()
49    {
50        unset($this->DBSessionHandler);
51    }
52
53    function test_DBsessionopen()
54    {
55        $this->DBSessionHandler->DBsessionopen('', '');
56    }
57
58    function test_DBsessionclose()
59    {
60        $this->DBSessionHandler->DBsessionclose();
61    }
62
63    function test_DBsessionread()
64    {
65        $this->DBSessionHandler->DBsessionread(session_id());
66    }
67
68    function test_DBsessionwrite()
69    {
70        if (!isset($_SESSION)) {
71            $_SESSION = array();
72        }
73        $this->DBSessionHandler->DBsessionwrite(session_id(), serialize($_SESSION));
74    }
75
76    function test_DBsessiondestroy()
77    {
78        $this->DBSessionHandler->DBsessiondestroy(session_id());
79    }
80
81    function test_DBsessiongarbage()
82    {
83        $this->DBSessionHandler->DBsessiongarbage(0);
84    }
85
86}
Note: See TracBrowser for help on using the repository browser.