The output* can't exit or the unittest crash. Put an exception
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2375 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -9,23 +9,23 @@ class test_outputhtml extends PHPUnit_Framework_TestCase
|
||||
/** Entry null */
|
||||
public function testlayout1 ()
|
||||
{
|
||||
$this->expectOutputRegex ("#<body>\s+</body>#");
|
||||
$output = new outputhtml ();
|
||||
$res = $output->out ("");
|
||||
$this->expectOutputRegex ("#<body>\s+</body>#", $res);
|
||||
}
|
||||
|
||||
public function testlayout2 ()
|
||||
{
|
||||
$this->expectOutputRegex("#data#");
|
||||
$output = new outputhtml ();
|
||||
$res = $output->out ("data");
|
||||
$this->expectOutputRegex("#data#");
|
||||
}
|
||||
|
||||
public function testlayout3 ()
|
||||
{
|
||||
$this->expectOutputRegex("#data#");
|
||||
$output = new outputhtml ();
|
||||
$res = $output->out ("data", "title");
|
||||
$this->expectOutputRegex("#data#");
|
||||
}
|
||||
|
||||
public function testlayout4 ()
|
||||
|
||||
@@ -30,5 +30,7 @@ class outputcsv extends output
|
||||
$out = fopen ('php://output', 'w');
|
||||
fputcsv ($out, $data);
|
||||
fclose ($out);
|
||||
if (!defined ("PHPUNIT"))
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ EOT;
|
||||
$resView = str_replace ($key, $val, $resView);
|
||||
|
||||
echo $resView;
|
||||
if (!defined ("PHPUNIT"))
|
||||
exit;
|
||||
}
|
||||
|
||||
/** Get the layout and provide it the variables. The variables will be push in
|
||||
|
||||
@@ -26,5 +26,7 @@ class outputjson extends output
|
||||
@header('Pragma: no-cache');
|
||||
@header ("Content-Type: application/json");
|
||||
echo json_encode ($data);
|
||||
if (!defined ("PHPUNIT"))
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,5 +128,7 @@ class outputtxt extends output
|
||||
echo "NULL\n";
|
||||
else
|
||||
echo "TODO : ".gettype ($rc)." on ".__FILE__.":".__LINE__."\n";
|
||||
if (!defined ("PHPUNIT"))
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ class outputxml extends output
|
||||
$this->array_to_xml ($data, $xml);
|
||||
//saving generated xml file
|
||||
print $xml->asXML();
|
||||
if (!defined ("PHPUNIT"))
|
||||
exit;
|
||||
}
|
||||
|
||||
/** function defination to convert array to xml
|
||||
|
||||
Reference in New Issue
Block a user