Skip to content

Commit 01ba644

Browse files
committed
Fix #79639 - Preserving the html report options in parallel worker mode
1 parent d0cbb72 commit 01ba644

File tree

2 files changed

+76
-76
lines changed

2 files changed

+76
-76
lines changed

run-tests.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3706,6 +3706,7 @@ public function wrapCommand($cmd, $memcheck_filename, $check_all)
37063706
}
37073707
}
37083708

3709+
37093710
function init_output_buffers()
37103711
{
37113712
// Delete as much output buffers as possible.
@@ -3738,4 +3739,79 @@ function check_proc_open_function_exists()
37383739
}
37393740
}
37403741

3742+
class OutputHandler
3743+
{
3744+
3745+
/**
3746+
* @var null|string
3747+
*/
3748+
private $htmlOutputFilename = null;
3749+
3750+
/**
3751+
* @var null|resource
3752+
*/
3753+
private $htmlHandle = null;
3754+
3755+
/**
3756+
* @param string $outputFilename
3757+
*/
3758+
public function setHtmlOutputFilename($outputFilename)
3759+
{
3760+
$this->htmlOutputFilename = $outputFilename;
3761+
}
3762+
3763+
public function clearHtmlFile()
3764+
{
3765+
ftruncate($this->getHtmlFileHandle(), 0);
3766+
}
3767+
3768+
/**
3769+
* @return string
3770+
*/
3771+
public function getHtmlOutputFilename()
3772+
{
3773+
if($this->htmlOutputFilename === null) {
3774+
throw new \Exception('No output filename has been set.');
3775+
}
3776+
3777+
return $this->htmlOutputFilename;
3778+
}
3779+
3780+
/**
3781+
* @return false|resource
3782+
*/
3783+
public function getHtmlFileHandle()
3784+
{
3785+
if($this->htmlHandle !== null) {
3786+
return $this->htmlHandle;
3787+
}
3788+
3789+
$this->fileHandle = fopen($this->getHtmlOutputFilename(), 'at+');
3790+
3791+
return $this->fileHandle;
3792+
}
3793+
3794+
/**
3795+
* @return bool
3796+
*/
3797+
public function isHtmlEnabled()
3798+
{
3799+
return !empty($this->getHtmlOutputFilename()) && is_resource($this->getHtmlFileHandle());
3800+
}
3801+
3802+
public function closeHtmlHandle()
3803+
{
3804+
fclose($this->getHtmlFileHandle());
3805+
}
3806+
3807+
/**
3808+
* @param $content
3809+
*/
3810+
public function writeHtml($content)
3811+
{
3812+
fwrite($this->getHtmlFileHandle(), $content);
3813+
}
3814+
3815+
}
3816+
37413817
main();

tests-util/OutputHandler.php

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)