diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..81acda7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +tests/settings.json +sys/db/tests/* \ No newline at end of file diff --git a/sys/common.php b/sys/common.php index dd1390d..ea47a17 100644 --- a/sys/common.php +++ b/sys/common.php @@ -230,15 +230,18 @@ function to_string($data, $method='print_r') // -------------------------------------------------------------------------- -/** - * Array_map callback to load a folder of classes at once - * - * @param string $path - * @return void - */ -function do_include($path) +if ( ! function_exists('do_include')) { - require_once($path); + /** + * Array_map callback to load a folder of classes at once + * + * @param string $path + * @return void + */ + function do_include($path) + { + require_once($path); + } } // -------------------------------------------------------------------------- diff --git a/tests/index.php b/tests/index.php index e8cc506..f4e148f 100644 --- a/tests/index.php +++ b/tests/index.php @@ -7,17 +7,25 @@ define('ENVIRONMENT', 'DEVELOPMENT'); require_once('simpletest/autorun.php'); // Set the default paths -define('MM_BASE_PATH', "../src/"); -define('MM_SYS_PATH', MM_BASE_PATH.'/sys/'); -define('MM_MOD_PATH', MM_BASE_PATH.'/modules/'); -define('MM_APP_PATH', MM_BASE_PATH.'/app/'); +define('MM_SYS_PATH', '../sys/'); +define('MM_MOD_PATH', '../modules/'); +define('MM_APP_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 -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 require_once('commonTest.php'); require_once('MMTest.php'); require_once('miniMVCTest.php'); -require_once('dbTest.php'); diff --git a/tests/miniMVCTest.php b/tests/miniMVCTest.php index 2ddd2aa..2a23a88 100644 --- a/tests/miniMVCTest.php +++ b/tests/miniMVCTest.php @@ -12,7 +12,7 @@ class miniMVCTest extends UnitTestCase { function setUp() { - $this->mm = new miniMVC(); + $this->mm = miniMVC::get_instance(); } function tearDown() @@ -32,7 +32,7 @@ class miniMVCTest extends UnitTestCase { // miniMVC::get_instance returns reference to latest miniMVC object $this->assertReference($this->mm, miniMVC::get_instance()); - // miniMVC extends JSObject, right? + // miniMVC extends MM, right? $this->assertIsA($this->mm, 'MM'); }