From 94cd07805dfad6131f0bcb33bf437a31d1f4d336 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 23 Oct 2009 07:49:14 -0700 Subject: Change the gallery_unit test to only intall into the test environment, modules that are active in the non-test environment. --- modules/gallery_unit_test/controllers/gallery_unit_test.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'modules/gallery_unit_test') diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index a5dbcc1f..85747884 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -96,6 +96,8 @@ class Gallery_Unit_Test_Controller extends Controller { @system("rm -rf test/var"); @mkdir('test/var/logs', 0777, true); + $active_modules = module::$active; + // Reset our caches module::$modules = array(); module::$active = array(); @@ -113,13 +115,12 @@ class Gallery_Unit_Test_Controller extends Controller { module::install("user"); module::activate("user"); $modules = array(); - foreach (glob(MODPATH . "*/helpers/*_installer.php") as $file) { - $module_name = basename(dirname(dirname($file))); - if (in_array($module_name, array("gallery", "user"))) { + foreach ($active_modules as $module) { + if (in_array($module->name, array("gallery", "user"))) { continue; } - module::install($module_name); - module::activate($module_name); + module::install($module->name); + module::activate($module->name); } // Trigger late-binding install actions (defined in gallery_event::user_login) -- cgit v1.2.3 From 703f22abcbf6c44818709d9daf3d272de98d9198 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 23 Oct 2009 09:24:09 -0700 Subject: Only look for tests that are in the active modules. Update the controller golden file to reflect the current location of files. --- modules/gallery/tests/controller_auth_data.txt | 10 +++++----- .../gallery_unit_test/controllers/gallery_unit_test.php | 17 +++++++---------- 2 files changed, 12 insertions(+), 15 deletions(-) (limited to 'modules/gallery_unit_test') diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt index fdf00c5e..30102538 100644 --- a/modules/gallery/tests/controller_auth_data.txt +++ b/modules/gallery/tests/controller_auth_data.txt @@ -9,6 +9,11 @@ modules/gallery/controllers/albums.php _form_add modules/gallery/controllers/combined.php javascript DIRTY_AUTH modules/gallery/controllers/combined.php css DIRTY_AUTH modules/gallery/controllers/file_proxy.php __call DIRTY_CSRF|DIRTY_AUTH +modules/gallery/controllers/login.php ajax DIRTY_AUTH +modules/gallery/controllers/login.php auth_ajax DIRTY_AUTH +modules/gallery/controllers/login.php html DIRTY_AUTH +modules/gallery/controllers/login.php auth_html DIRTY_AUTH +modules/gallery/controllers/logout.php index DIRTY_CSRF|DIRTY_AUTH modules/gallery/controllers/maintenance.php index DIRTY_AUTH modules/gallery/controllers/rest.php __construct DIRTY_AUTH modules/gallery/controllers/rest.php __call DIRTY_AUTH @@ -31,10 +36,5 @@ modules/server_add/controllers/admin_server_add.php autocomplete modules/server_add/controllers/server_add.php children DIRTY_CSRF modules/tag/controllers/admin_tags.php index DIRTY_CSRF modules/tag/controllers/tags.php _show DIRTY_CSRF|DIRTY_AUTH -modules/user/controllers/login.php ajax DIRTY_AUTH -modules/user/controllers/login.php auth_ajax DIRTY_AUTH -modules/user/controllers/login.php html DIRTY_AUTH -modules/user/controllers/login.php auth_html DIRTY_AUTH -modules/user/controllers/logout.php index DIRTY_CSRF|DIRTY_AUTH modules/user/controllers/password.php reset DIRTY_AUTH modules/user/controllers/password.php do_reset DIRTY_CSRF|DIRTY_AUTH diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index 85747884..f72b1b08 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -77,14 +77,6 @@ class Gallery_Unit_Test_Controller extends Controller { } try { - // Find all tests, excluding sample tests that come with the unit_test module. - foreach (glob(MODPATH . "*/tests") as $path) { - if ($path != MODPATH . "unit_test/tests") { - $paths[] = $path; - } - } - Kohana::config_set('unit_test.paths', $paths); - // Clean out the database if ($tables = $db->list_tables()) { foreach ($db->list_tables() as $table) { @@ -107,15 +99,18 @@ class Gallery_Unit_Test_Controller extends Controller { // Rest the cascading class path Kohana::config_set("core", Kohana::config_load("core")); - // Install all modules + // Install the active modules // Force gallery and user to be installed first to resolve dependencies. gallery_installer::install(true); module::load_modules(); module::install("user"); module::activate("user"); - $modules = array(); + $modules = $paths =array(); foreach ($active_modules as $module) { + if (file_exists($path = MODPATH . "{$module->name}/tests")) { + $paths[] = $path; + } if (in_array($module->name, array("gallery", "user"))) { continue; } @@ -123,6 +118,8 @@ class Gallery_Unit_Test_Controller extends Controller { module::activate($module->name); } + Kohana::config_set('unit_test.paths', $paths); + // Trigger late-binding install actions (defined in gallery_event::user_login) graphics::choose_default_toolkit(); -- cgit v1.2.3 From 2a21f3bc80758a20635534b837c11836a72b202c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 28 Oct 2009 11:37:05 -0700 Subject: Only install and activate modules that have tests to run. --- .../gallery_unit_test/controllers/gallery_unit_test.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'modules/gallery_unit_test') diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php index f72b1b08..58e0d9c5 100644 --- a/modules/gallery_unit_test/controllers/gallery_unit_test.php +++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php @@ -106,16 +106,17 @@ class Gallery_Unit_Test_Controller extends Controller { module::install("user"); module::activate("user"); - $modules = $paths =array(); - foreach ($active_modules as $module) { - if (file_exists($path = MODPATH . "{$module->name}/tests")) { - $paths[] = $path; - } - if (in_array($module->name, array("gallery", "user"))) { + $modules = $paths = array(); + foreach (module::available() as $module_name => $unused) { + if (in_array($module_name, array("gallery", "user"))) { + $paths[] = MODPATH . "{$module_name}/tests"; continue; } - module::install($module->name); - module::activate($module->name); + if (file_exists($path = MODPATH . "{$module_name}/tests")) { + $paths[] = $path; + module::install($module_name); + module::activate($module_name); + } } Kohana::config_set('unit_test.paths', $paths); -- cgit v1.2.3