mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
debug testcase failed
This commit is contained in:
@@ -42,10 +42,10 @@ class ThemeHandlerTest extends ItopTestCase
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
foreach ($this->aDirsToCleanup as $dir)
|
||||
/*foreach ($this->aDirsToCleanup as $dir)
|
||||
{
|
||||
$this->rrmdir($dir);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
function rrmdir($dir) {
|
||||
@@ -367,10 +367,49 @@ JSON;
|
||||
{
|
||||
$this->assertTrue(false, "Cannot find expected main css file $sExpectedMainCssFile");
|
||||
}
|
||||
$this->assertEquals(file_get_contents($sExpectedMainCssFile), file_get_contents($cssPath));
|
||||
Exec("ls -al $sExpectedMainCssFile");
|
||||
Exec("ls -al $cssPath");
|
||||
$this->assertEquals(file_get_contents($sExpectedMainCssFile), file_get_contents($cssPath), "File dont match ($sExpectedMainCssFile/ $cssPath)");
|
||||
}
|
||||
}
|
||||
|
||||
function Exec($cmd, $workdir = null) {
|
||||
$iBeginTime = time();
|
||||
if (is_null($workdir)) {
|
||||
$workdir = __DIR__;
|
||||
}
|
||||
|
||||
$descriptorspec = array(
|
||||
0 => array("pipe", "r"), // stdin
|
||||
1 => array("pipe", "w"), // stdout
|
||||
2 => array("pipe", "w"), // stderr
|
||||
);
|
||||
$process = proc_open($cmd, $descriptorspec, $pipes, $workdir, null);
|
||||
|
||||
$stdout = stream_get_contents($pipes[1]);
|
||||
fclose($pipes[1]);
|
||||
|
||||
$stderr = stream_get_contents($pipes[2]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
$code = proc_close($process);
|
||||
|
||||
$iElapsed = time() - $iBeginTime;
|
||||
echo("========= ELAPSED:${iElapsed}s cd $workdir; $cmd");
|
||||
if (0 === $code) {
|
||||
if ($this->explode)
|
||||
{
|
||||
$msg = explode("\n", trim($stdout));
|
||||
}
|
||||
else{
|
||||
$msg = $stdout;
|
||||
}
|
||||
} else {
|
||||
$msg = "Command failed : cd $workdir; $cmd \n\t\t=== with status:$code \n\t\t=== stderr:$stderr \n\t\t=== stdout: $stdout";
|
||||
}
|
||||
echo $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user