From b5b869419f37e830b19c0f0fc9d75f4196abfdfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Fri, 12 Feb 2016 15:28:22 +0100 Subject: [PATCH] Avoid nested output buffer problems in test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- js/messages.php | 12 +++++++----- test/libraries/Files_test.php | 8 +++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/js/messages.php b/js/messages.php index f8e31e2cfa..34b3bc6363 100644 --- a/js/messages.php +++ b/js/messages.php @@ -30,11 +30,13 @@ require_once './libraries/js_escape.lib.php'; $buffer = PMA\libraries\OutputBuffering::getInstance(); $buffer->start(); -register_shutdown_function( - function () { - echo PMA\libraries\OutputBuffering::getInstance()->getContents(); - } -); +if (!defined('TESTSUITE')) { + register_shutdown_function( + function () { + echo PMA\libraries\OutputBuffering::getInstance()->getContents(); + } + ); +} $js_messages['strNoDropDatabases'] = __('"DROP DATABASE" statements are disabled.'); if ($cfg['AllowUserDropDatabase']) { diff --git a/test/libraries/Files_test.php b/test/libraries/Files_test.php index 6129171dc9..88c28fe449 100644 --- a/test/libraries/Files_test.php +++ b/test/libraries/Files_test.php @@ -31,15 +31,17 @@ class FilesTest extends PHPUnit_Framework_TestCase public function testJsMessages() { - ob_start(); $GLOBALS['pmaThemeImage'] = ''; $cfg = array( 'AllowUserDropDatabase' => true, 'GridEditing' => 'click', + 'OBGzip' => false, + 'ServerDefault' => 1, ); + $GLOBALS['cfg'] = $cfg; require 'js/messages.php'; - $out = ob_get_contents(); - ob_end_clean(); + $buffer->stop(); + $out = $buffer->getContents(); $this->assertContains('var PMA_messages = new Array();', $out); }