debug testcase failed

This commit is contained in:
odain
2020-06-08 11:26:12 +02:00
parent f5886f603b
commit 4741012fb9

View File

@@ -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
*/