From 6f959deed90750d3f87f26e64fc44beb3f7ba903 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 3 Dec 2008 03:23:30 +0000 Subject: Rename generic test.php to gallery_unit_test.php to make navigation to this file a little easier --- index.php | 2 +- .../controllers/gallery_unit_test.php | 105 +++++++++++++++++++++ modules/gallery_unit_test/controllers/test.php | 105 --------------------- 3 files changed, 106 insertions(+), 106 deletions(-) create mode 100644 modules/gallery_unit_test/controllers/gallery_unit_test.php delete mode 100644 modules/gallery_unit_test/controllers/test.php diff --git a/index.php b/index.php index 96360bfe..44b00e67 100644 --- a/index.php +++ b/index.php @@ -47,7 +47,7 @@ define('SYSPATH', strtr(realpath('kohana') . '/', DIRECTORY_SEPARATOR, '/')); // Force a test run if we're in command line mode. if (PHP_SAPI == 'cli') { - $_SERVER['argv'] = array($_SERVER['argv'][0], 'test'); + $_SERVER['argv'] = array($_SERVER['argv'][0], 'gallery_unit_test'); define('TEST_MODE', 1); @system('mkdir -p test/var/logs'); define('VARPATH', strtr(realpath('test/var') . '/', DIRECTORY_SEPARATOR, '/')); diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php new file mode 100644 index 00000000..2046e323 --- /dev/null +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -0,0 +1,105 @@ +connect(); + + // Make this the default database for the rest of this run + Database::$instances = array('default' => $db); + } catch (Exception $e) { + print "{$e->getMessage()}\n"; + return; + } + } + + // Find all tests, excluding sample tests that come with the unit_test module. + $paths = array(APPPATH . "tests"); + foreach (glob(MODPATH . "*/tests") as $path) { + if ($path != MODPATH . "unit_test/tests") { + $paths[] = $path; + } + } + Kohana::config_set('unit_test.paths', $paths); + + // We probably don't want to uninstall and reinstall the core every time, but let's start off + // this way. Uninstall modules first and core last. Ignore errors during uninstall. + try { + $this->_uninstall_modules(); + } catch (Exception $e) { + } + + $this->_install_modules(); + + print new Unit_Test(); + } + + private function _uninstall_modules() { + foreach (module::installed() as $module) { + if ($module->name == "core") { + continue; + } + + $installer_class = "{$module->name}_installer"; + Kohana::log("debug", "$installer_class"); + if (method_exists($installer_class, "uninstall")) { + call_user_func_array(array($installer_class, "uninstall"), array()); + } + } + + // Always uninstall core last. + core_installer::uninstall(); + } + + private function _install_modules() { + core_installer::install(); + + foreach (glob(MODPATH . "*/helpers/*_installer.php") as $file) { + $module_name = basename(dirname(dirname($file))); + if ($module_name == "core") { + continue; + } + + $installer_class = "{$module_name}_installer"; + if (method_exists($installer_class, "install")) { + call_user_func_array(array($installer_class, "install"), array()); + } + } + } +} diff --git a/modules/gallery_unit_test/controllers/test.php b/modules/gallery_unit_test/controllers/test.php deleted file mode 100644 index b5835556..00000000 --- a/modules/gallery_unit_test/controllers/test.php +++ /dev/null @@ -1,105 +0,0 @@ -connect(); - - // Make this the default database for the rest of this run - Database::$instances = array('default' => $db); - } catch (Exception $e) { - print "{$e->getMessage()}\n"; - return; - } - } - - // Find all tests, excluding sample tests that come with the unit_test module. - $paths = array(APPPATH . "tests"); - foreach (glob(MODPATH . "*/tests") as $path) { - if ($path != MODPATH . "unit_test/tests") { - $paths[] = $path; - } - } - Kohana::config_set('unit_test.paths', $paths); - - // We probably don't want to uninstall and reinstall the core every time, but let's start off - // this way. Uninstall modules first and core last. Ignore errors during uninstall. - try { - $this->_uninstall_modules(); - } catch (Exception $e) { - } - - $this->_install_modules(); - - print new Unit_Test(); - } - - private function _uninstall_modules() { - foreach (module::installed() as $module) { - if ($module->name == "core") { - continue; - } - - $installer_class = "{$module->name}_installer"; - Kohana::log("debug", "$installer_class"); - if (method_exists($installer_class, "uninstall")) { - call_user_func_array(array($installer_class, "uninstall"), array()); - } - } - - // Always uninstall core last. - core_installer::uninstall(); - } - - private function _install_modules() { - core_installer::install(); - - foreach (glob(MODPATH . "*/helpers/*_installer.php") as $file) { - $module_name = basename(dirname(dirname($file))); - if ($module_name == "core") { - continue; - } - - $installer_class = "{$module_name}_installer"; - if (method_exists($installer_class, "install")) { - call_user_func_array(array($installer_class, "install"), array()); - } - } - } -} -- cgit v1.2.3