From 6296f99568b41811c9e425c096cd556fd8306836 Mon Sep 17 00:00:00 2001 From: Marius Orcsik Date: Fri, 1 May 2009 18:37:54 +0200 Subject: [PATCH] * simplified the usage of the unittest loader --- _res/_libs/tests/tsunittest.class.php | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/_res/_libs/tests/tsunittest.class.php b/_res/_libs/tests/tsunittest.class.php index a132bd1..39c122f 100644 --- a/_res/_libs/tests/tsunittest.class.php +++ b/_res/_libs/tests/tsunittest.class.php @@ -32,16 +32,9 @@ class tsUnitTest extends TestSuite { } } - if ($sPackageName) { - $aPackages = self::getInstance()->getTestsByPackage ($sPackageName); - foreach ($aPackages as $sPath) { - $tests[] = $loader->load ($sPath); - } - }else { - $aPackages = self::getInstance()->getAllTests (); - foreach ($aPackages as $sPath) { - $tests[] = $loader->load ($sPath); - } + $aPackages = self::getInstance()->getTests ($sPackageName); + foreach ($aPackages as $sPath) { + $tests[] = $loader->load ($sPath); } foreach ($tests as $suite) { @@ -59,20 +52,9 @@ class tsUnitTest extends TestSuite { return self::$instance; } - private function getTestsByPackage ($sPackageName) { + private function getTests ($sPackageName = '') { $aFiles = getDirFiles (VSC_TEST_PATH . $sPackageName); - foreach ($aFiles as $key=>$sPath) { - if (!stristr($sPath, 'Test.php')) { - unset($aFiles[$key]); - } - } - return $aFiles; - } - -// private function getAllPackages () {} - - private function getAllTests () { - $aFiles = getDirFiles (VSC_TEST_PATH); + d($aFiles); foreach ($aFiles as $key=>$sPath) { if (!stristr($sPath, 'Test.php')) { unset($aFiles[$key]); -- 2.11.4.GIT