Advanced Tester usage
These are either advanced or just too cumbersome to include in the readme
Modify HTML Output
This is the exact code used in the Tester
class. You just have to overwrite this method in your child class.
public function htmlOutput($details){
ob_start();
$successStatement = $details->result ? '<span style="color:green;">success</span>' : '<span style="color:red;">fail</span>';
if ($details->error!=null)$successStatement = '<strong style="color:blue;">error</strong>';
if ($details->disabled===true)$successStatement = '<strong style="color:orange;">disabled</strong>';
$diff = $details->bench->diff;
if ($diff < 0.0001)$diff = '';
else $diff = 'in '.number_format($diff*1000,3).'ms';
echo "<details>\n <summary><b>".$details->method.":</b> ".$successStatement." {$diff} </summary>\n";
// echo " <div>Time to run: ".$details->bench->diff."</div>";
echo " <div style='padding-left:4ch;white-space:pre;'>\n";
$detailsOutput = htmlentities($details->output);
$detailsLines = explode("\n",$detailsOutput);
$detailsLines = array_map(function($value){return ' '.$value;},$detailsLines);
echo implode("\n",$detailsLines);
// var_dump($detailsLines);
echo "\n </div>";
if ($details->error!=null){
echo "\n <br>\n";
echo " <div style='color:red;padding-left:4ch;white-space:pre;'>\n";
$errorOutput = $details->error;
$errorLines = explode("\n",$errorOutput);
$errorLines = array_map(function($value){return ' '.$value;},$errorLines);
echo implode("\n",$errorLines);
echo "\n </div>";
}
echo "\n</details>\n";
return ob_get_clean();
}
Refresh Firefox Browser Tab
Call Taeluf\Tester::xdotoolRefreshFirefox($switchBackToCurrWindow = false)
to refresh your browser tab.
If you're writing you're using runAllToFile($file)
, this could come in handy.
@deprecated in favor of \Taeluf\Tester\Utility::xdotoolRefreshFirefox()