summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-03-02 15:32:20 +0100
committerRobin Appelman <icewind@owncloud.com>2012-03-02 18:42:57 +0100
commit3b9ce95fc3ebe3ab6ab8a7d47dec679bb9a4453b (patch)
tree3816bc34eb359ad250f1273f7d5213332206ee2e /tests
parentd1dcd7893cb878263b8179bab16d101036c57a88 (diff)
downloadnextcloud-server-3b9ce95fc3ebe3ab6ab8a7d47dec679bb9a4453b.tar.gz
nextcloud-server-3b9ce95fc3ebe3ab6ab8a7d47dec679bb9a4453b.zip
allow apps to ship test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/index.php24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/index.php b/tests/index.php
index 1333a83a3b9..b5ae55808a1 100644
--- a/tests/index.php
+++ b/tests/index.php
@@ -26,20 +26,27 @@ require_once 'simpletest/mock_objects.php';
require_once 'simpletest/collector.php';
require_once 'simpletest/default_reporter.php';
-//load all test cases
-loadTests();
+//load core test cases
+loadTests(dirname(__FILE__));
+
+//load app test cases
+$apps=OC_App::getAllApps();
+foreach($apps as $app){
+ if(is_dir(OC::$SERVERROOT.'/apps/'.$app.'/tests')){
+ loadTests(OC::$SERVERROOT.'/apps/'.$app.'/tests');
+ }
+}
function loadTests($dir=''){
- $basedir=dirname(__FILE__).'/';
- if($dh=opendir($basedir.$dir)){
+ if($dh=opendir($dir)){
while($name=readdir($dh)){
if(substr($name,0,1)!='.'){//no hidden files, '.' or '..'
$file=$dir.'/'.$name;
- if(is_dir($basedir.$file)){
+ if(is_dir($file)){
loadTests($file);
}elseif(substr($file,-4)=='.php' and $file!=__FILE__){
$testCase=new TestSuite(getTestName($file));
- $testCase->addFile($basedir.$file);
+ $testCase->addFile($file);
if($testCase->getSize()>0){
$testCase->run(new HtmlReporter());
}
@@ -50,6 +57,7 @@ function loadTests($dir=''){
}
function getTestName($file){
- //TODO: get better test names
- return substr($file,5,-4);//strip /lib/ and .php
+// //TODO: get better test names
+ $file=substr($file,strlen(OC::$SERVERROOT));
+ return substr($file,0,-4);//strip .php
}