diff --git a/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php b/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
index f73bb1927..f77c6f37b 100644
--- a/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
+++ b/lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
@@ -25,6 +25,13 @@ App::uses('CakeBaseReporter', 'TestSuite/Reporter');
*/
class CakeHtmlReporter extends CakeBaseReporter {
+/**
+ * The content buffer
+ *
+ * @var string
+ */
+ protected $_buffer = '';
+
/**
* Paints the top of the web page setting the
* title to the name of the starting test.
@@ -33,12 +40,13 @@ class CakeHtmlReporter extends CakeBaseReporter {
*/
public function paintHeader() {
$this->_headerSent = true;
+ ob_start();
$this->sendContentType();
$this->sendNoCacheHeaders();
$this->paintDocumentStart();
$this->paintTestMenu();
echo "
_getStackTrace($message);
$className = get_class($test);
$testName = $className . '::' . $test->getName() . '()';
@@ -286,6 +296,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
}
echo "
" . __d('cake_dev', 'Stack trace:') . '
' . $trace . "
\n";
echo "\n";
+ $this->_buffer .= ob_get_clean();
}
/**
@@ -298,6 +309,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
* @return void
*/
public function paintPass(PHPUnit_Framework_Test $test, $time = null) {
+ ob_start();
if (isset($this->params['showPasses']) && $this->params['showPasses']) {
echo "
\n";
echo "Passed ";
@@ -305,6 +317,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
echo "
" . $this->_htmlEntities($test->getName()) . " ($time seconds)\n";
echo "\n";
}
+ $this->_buffer .= ob_get_clean();
}
/**
@@ -315,6 +328,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
* @return void
*/
public function paintException($message, $test) {
+ ob_start();
$trace = $this->_getStackTrace($message);
$testName = get_class($test) . '(' . $test->getName() . ')';
@@ -325,6 +339,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
echo "
" . __d('cake_dev', 'Test case: %s', $testName) . "
\n";
echo "
" . __d('cake_dev', 'Stack trace:') . '
' . $trace . "
\n";
echo "\n";
+ $this->_buffer .= ob_get_clean();
}
/**
@@ -335,10 +350,12 @@ class CakeHtmlReporter extends CakeBaseReporter {
* @return void
*/
public function paintSkip($message, $test) {
+ ob_start();
echo "
\n";
echo "Skipped ";
echo $test->getName() . ': ' . $this->_htmlEntities($message->getMessage());
echo "\n";
+ $this->_buffer .= ob_get_clean();
}
/**
@@ -390,9 +407,9 @@ class CakeHtmlReporter extends CakeBaseReporter {
*/
public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
if (!$this->_headerSent) {
- echo $this->paintHeader();
+ $this->paintHeader();
}
- echo '
' . __d('cake_dev', 'Running %s', $suite->getName()) . '
';
+ $this->_buffer .= '
' . __d('cake_dev', 'Running %s', $suite->getName()) . '
';
}
/**