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))
|
||||||
|
@ -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');
|
||||||
|
|
||||||
|
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