Fix tests

This commit is contained in:
Timothy Warren 2012-05-18 16:20:47 -04:00
parent 8e97f37fe0
commit a21a99f10f
4 changed files with 29 additions and 16 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
tests/settings.json
sys/db/tests/*

View File

@ -230,15 +230,18 @@ function to_string($data, $method='print_r')
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** if ( ! function_exists('do_include'))
{
/**
* Array_map callback to load a folder of classes at once * Array_map callback to load a folder of classes at once
* *
* @param string $path * @param string $path
* @return void * @return void
*/ */
function do_include($path) function do_include($path)
{ {
require_once($path); require_once($path);
}
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@ -7,17 +7,25 @@ define('ENVIRONMENT', 'DEVELOPMENT');
require_once('simpletest/autorun.php'); require_once('simpletest/autorun.php');
// Set the default paths // Set the default paths
define('MM_BASE_PATH', "../src/"); define('MM_SYS_PATH', '../sys/');
define('MM_SYS_PATH', MM_BASE_PATH.'/sys/'); define('MM_MOD_PATH', '../modules/');
define('MM_MOD_PATH', MM_BASE_PATH.'/modules/'); define('MM_APP_PATH', '../app/');
define('MM_APP_PATH', MM_BASE_PATH.'/app/');
// Include db autoloader
require_once(MM_SYS_PATH . 'db/autoload.php');
// Include db tests
require_once(MM_SYS_PATH . 'db/tests/index.php');
//Include src files //Include src files
require_once('../src/sys/common.php'); require_once(MM_SYS_PATH . 'common.php');
require_once(MM_SYS_PATH . 'core/traits.php');
require_once(MM_SYS_PATH . 'core/MM.php');
require_once(MM_SYS_PATH . 'core/miniMVC.php');
array_map('do_include', glob(MM_SYS_PATH . 'core/*.php'));
//Include test files //Include test files
require_once('commonTest.php'); require_once('commonTest.php');
require_once('MMTest.php'); require_once('MMTest.php');
require_once('miniMVCTest.php'); require_once('miniMVCTest.php');
require_once('dbTest.php');

View File

@ -12,7 +12,7 @@ class miniMVCTest extends UnitTestCase {
function setUp() function setUp()
{ {
$this->mm = new miniMVC(); $this->mm = miniMVC::get_instance();
} }
function tearDown() function tearDown()
@ -32,7 +32,7 @@ class miniMVCTest extends UnitTestCase {
// miniMVC::get_instance returns reference to latest miniMVC object // miniMVC::get_instance returns reference to latest miniMVC object
$this->assertReference($this->mm, miniMVC::get_instance()); $this->assertReference($this->mm, miniMVC::get_instance());
// miniMVC extends JSObject, right? // miniMVC extends MM, right?
$this->assertIsA($this->mm, 'MM'); $this->assertIsA($this->mm, 'MM');
} }