fix running test cases from browser

This commit is contained in:
Robin Appelman 2012-07-19 16:19:23 +02:00
parent b30da61d59
commit e031b9b880
1 changed files with 4 additions and 5 deletions

View File

@ -32,8 +32,7 @@ $testSuiteName="ownCloud Unit Test Suite";
if(OC::$CLI){ if(OC::$CLI){
$reporter=new TextReporter; $reporter=new TextReporter;
$test=isset($_SERVER['argv'][1])?$_SERVER['argv'][1]:false; $test=isset($_SERVER['argv'][1])?$_SERVER['argv'][1]:false;
if($test=='xml') if($test=='xml'){
{
$reporter= new XmlReporter; $reporter= new XmlReporter;
$test=false; $test=false;
@ -42,7 +41,7 @@ if(OC::$CLI){
} }
} }
}else{ }else{
$reporter='HtmlReporter'; $reporter=new HtmlReporter;
$test=isset($_GET['test'])?$_GET['test']:false; $test=isset($_GET['test'])?$_GET['test']:false;
} }
@ -81,10 +80,10 @@ function loadTests($dir,$testSuite, $test){
}elseif(substr($file,-4)=='.php' and $file!=__FILE__){ }elseif(substr($file,-4)=='.php' and $file!=__FILE__){
$name=getTestName($file); $name=getTestName($file);
if($test===false or $test==$name or substr($name,0,strlen($test))==$test){ if($test===false or $test==$name or substr($name,0,strlen($test))==$test){
$extractor = new SimpleFileLoader(); $extractor = new SimpleFileLoader();
$loadedSuite=$extractor->load($file); $loadedSuite=$extractor->load($file);
if ($loadedSuite->getSize() > 0) if ($loadedSuite->getSize() > 0)
$testSuite->add($loadedSuite); $testSuite->add($loadedSuite);
} }
} }
} }