[1] | 1 | <?php |
---|
| 2 | /** |
---|
[362] | 3 | * The Strangecode Codebase - a general application development framework for PHP |
---|
| 4 | * For details visit the project site: <http://trac.strangecode.com/codebase/> |
---|
[376] | 5 | * Copyright 2001-2010 Strangecode, LLC |
---|
[362] | 6 | * |
---|
| 7 | * This file is part of The Strangecode Codebase. |
---|
[42] | 8 | * |
---|
[362] | 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 | * |
---|
[42] | 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 | * |
---|
[1] | 30 | * Created with PHPUnit_Skeleton on 2005-08-09 |
---|
| 31 | */ |
---|
| 32 | require_once 'PHPUnit.php'; |
---|
| 33 | class 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(); |
---|
[136] | 47 | $this->DBSessionHandler = new DBSessionHandler($app->db, array( |
---|
| 48 | 'db_table' => 'session_tbl', |
---|
| 49 | 'create_table' => true, |
---|
[1] | 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); |
---|
| 92 | echo $result->toString(); |
---|
| 93 | ?> |
---|