From 08f9822b72932bafa4aa6327f601e1901e2e0003 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 1 Nov 2008 09:02:24 +0000 Subject: Exclude demo tests --- modules/gallery_unit_test/controllers/test.php | 11 +++++++++++ modules/gallery_unit_test/views/kohana_unit_test.php | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'modules/gallery_unit_test') diff --git a/modules/gallery_unit_test/controllers/test.php b/modules/gallery_unit_test/controllers/test.php index de3a3410..d7a9de90 100644 --- a/modules/gallery_unit_test/controllers/test.php +++ b/modules/gallery_unit_test/controllers/test.php @@ -22,6 +22,17 @@ class Test_Controller extends Controller { if (!defined('TEST_MODE')) { print Kohana::show_404(); } + + // 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); + $test = new Unit_Test(DOCROOT . "modules/gallery_unit_test/tests"); echo $test; } diff --git a/modules/gallery_unit_test/views/kohana_unit_test.php b/modules/gallery_unit_test/views/kohana_unit_test.php index 2201245c..c5ca6f30 100644 --- a/modules/gallery_unit_test/views/kohana_unit_test.php +++ b/modules/gallery_unit_test/views/kohana_unit_test.php @@ -51,8 +51,10 @@ foreach ($results as $class => $methods) { } printf(">> TOTAL\t%s: %.2f%%\t%s: %d\t%s: %d\t%s: %d\t%s: %d\n", - Kohana::lang("unit_test.score"), 100 * ($totals["passed"] / $totals["total"]), + Kohana::lang("unit_test.score"), + ($totals["total"] ? 100 * ($totals["passed"] / $totals["total"]) : 0), Kohana::lang("unit_test.total"), $totals["total"], Kohana::lang("unit_test.passed"), $totals["passed"], Kohana::lang("unit_test.failed"), $totals["failed"], Kohana::lang("unit_test.errors"), $totals["errors"]); + -- cgit v1.2.3