Start of unit tests for settings class
This commit is contained in:
parent
7acbe41e8f
commit
b8f9f79179
@ -39,6 +39,11 @@ class Settings {
|
|||||||
*/
|
*/
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
|
if ( ! defined('SETTINGS_DIR'))
|
||||||
|
{
|
||||||
|
define('SETTINGS_DIR', '.');
|
||||||
|
}
|
||||||
|
|
||||||
$path = SETTINGS_DIR.'/settings.json';
|
$path = SETTINGS_DIR.'/settings.json';
|
||||||
|
|
||||||
if( ! is_file($path))
|
if( ! is_file($path))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2012
|
* @copyright Copyright (c) 2012
|
||||||
* @link https://github.com/aviat4ion/OpenSQLManager
|
* @link https://github.com/aviat4ion/OpenSQLManager
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -26,6 +26,7 @@ require_once('simpletest/autorun.php');
|
|||||||
|
|
||||||
// Require base testing classes
|
// Require base testing classes
|
||||||
require_once(TEST_DIR.'/parent.php');
|
require_once(TEST_DIR.'/parent.php');
|
||||||
|
require_once(TEST_DIR.'/settings.php');
|
||||||
|
|
||||||
// Bulk loading wrapper workaround for PHP < 5.4
|
// Bulk loading wrapper workaround for PHP < 5.4
|
||||||
function do_include($path)
|
function do_include($path)
|
||||||
@ -35,6 +36,7 @@ function do_include($path)
|
|||||||
|
|
||||||
// Include core tests
|
// Include core tests
|
||||||
require_once("core.php");
|
require_once("core.php");
|
||||||
|
require_once(BASE_DIR.'common/settings.php');
|
||||||
require_once(BASE_DIR.'db/db_pdo.php');
|
require_once(BASE_DIR.'db/db_pdo.php');
|
||||||
require_once(BASE_DIR.'db/query_builder.php');
|
require_once(BASE_DIR.'db/query_builder.php');
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ $test_path = TEST_DIR.'/databases/';
|
|||||||
|
|
||||||
foreach(pdo_drivers() as $d)
|
foreach(pdo_drivers() as $d)
|
||||||
{
|
{
|
||||||
// PDO firebird isn't stable enough to
|
// PDO firebird isn't stable enough to
|
||||||
// bother, so skip it.
|
// bother, so skip it.
|
||||||
if ($d === 'firebird')
|
if ($d === 'firebird')
|
||||||
{
|
{
|
||||||
@ -54,7 +56,7 @@ foreach(pdo_drivers() as $d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$src_file = "{$src_path}{$d}.php";
|
$src_file = "{$src_path}{$d}.php";
|
||||||
|
|
||||||
if(is_file($src_file))
|
if(is_file($src_file))
|
||||||
{
|
{
|
||||||
require_once("{$src_path}{$d}.php");
|
require_once("{$src_path}{$d}.php");
|
||||||
|
30
tests/settings.php
Normal file
30
tests/settings.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* OpenSQLManager
|
||||||
|
*
|
||||||
|
* Free Database manager for Open Source Databases
|
||||||
|
*
|
||||||
|
* @author Timothy J. Warren
|
||||||
|
* @copyright Copyright (c) 2012
|
||||||
|
* @link https://github.com/aviat4ion/OpenSQLManager
|
||||||
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings Class Test Class
|
||||||
|
*/
|
||||||
|
class SettingsTest extends UnitTestCase {
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->settings =& Settings::get_instance();
|
||||||
|
}
|
||||||
|
|
||||||
|
function TestExists()
|
||||||
|
{
|
||||||
|
$this->assertIsA($this->settings, 'Settings');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user