[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/> |
---|
[396] | 5 | * Copyright 2001-2012 Strangecode, LLC |
---|
[468] | 6 | * |
---|
[362] | 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. |
---|
[468] | 13 | * |
---|
[362] | 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. |
---|
[468] | 18 | * |
---|
[362] | 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 | |
---|
[468] | 33 | class DBSessionHandlerTest extends PHPUnit_Framework_TestCase { |
---|
| 34 | |
---|
[1] | 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(); |
---|
[136] | 42 | $this->DBSessionHandler = new DBSessionHandler($app->db, array( |
---|
| 43 | 'db_table' => 'session_tbl', |
---|
| 44 | 'create_table' => true, |
---|
[1] | 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 | { |
---|
[468] | 70 | if (!isset($_SESSION)) { |
---|
| 71 | $_SESSION = array(); |
---|
| 72 | } |
---|
[1] | 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 | } |
---|