diff --git a/tests/TestCase/Http/ResponseEmitterTest.php b/tests/TestCase/Http/ResponseEmitterTest.php index 101be00f612..daf70040250 100644 --- a/tests/TestCase/Http/ResponseEmitterTest.php +++ b/tests/TestCase/Http/ResponseEmitterTest.php @@ -28,13 +28,30 @@ class ResponseEmitterTest extends TestCase { protected $emitter; + /** + * setup + * + * @return void + */ public function setUp() { parent::setUp(); + $GLOBALS['mockedHeadersSent'] = false; $GLOBALS['mockedHeaders'] = $GLOBALS['mockedCookies'] = []; $this->emitter = new ResponseEmitter(); } + /** + * teardown + * + * @return void + */ + public function tearDown() + { + parent::tearDown(); + unset($GLOBALS['mockedHeadersSent']); + } + /** * Test emitting simple responses. * diff --git a/tests/TestCase/Http/ResponseTest.php b/tests/TestCase/Http/ResponseTest.php index bac96c4240d..53714bc871c 100644 --- a/tests/TestCase/Http/ResponseTest.php +++ b/tests/TestCase/Http/ResponseTest.php @@ -46,6 +46,7 @@ public function setUp() { parent::setUp(); $this->server = $_SERVER; + $GLOBALS['mockedHeadersSent'] = false; } /** @@ -57,6 +58,7 @@ public function tearDown() { parent::tearDown(); $_SERVER = $this->server; + unset($GLOBALS['mockedHeadersSent']); } /** diff --git a/tests/TestCase/Http/ServerTest.php b/tests/TestCase/Http/ServerTest.php index 3deeddd5eb0..3440411d6c5 100644 --- a/tests/TestCase/Http/ServerTest.php +++ b/tests/TestCase/Http/ServerTest.php @@ -42,6 +42,7 @@ public function setUp() $this->server = $_SERVER; $this->config = dirname(dirname(__DIR__)); $GLOBALS['mockedHeaders'] = []; + $GLOBALS['mockedHeadersSent'] = false; } /** @@ -53,6 +54,7 @@ public function tearDown() { parent::tearDown(); $_SERVER = $this->server; + unset($GLOBALS['mockedHeadersSent']); } /** diff --git a/tests/TestCase/Http/server_mocks.php b/tests/TestCase/Http/server_mocks.php index 60a2c33f61b..24a5582ebd9 100644 --- a/tests/TestCase/Http/server_mocks.php +++ b/tests/TestCase/Http/server_mocks.php @@ -6,7 +6,7 @@ function headers_sent() { - return false; + return isset($GLOBALS['mockedHeadersSent']) ? $GLOBALS['mockedHeadersSent'] : true; } function header($header)