Browse Source

Fixing failing tests

Jose Lorenzo Rodriguez 11 years ago
parent
commit
79d288ba2b

+ 1 - 2
src/Network/Response.php

@@ -442,9 +442,8 @@ class Response {
 			return;
 		}
 
-		$this->_setCookies();
-
 		$codeMessage = $this->_statusCodes[$this->_status];
+		$this->_setCookies();
 		$this->_sendHeader("{$this->_protocol} {$this->_status} {$codeMessage}");
 		$this->_setContentType();
 

+ 1 - 2
tests/TestCase/Network/ResponseTest.php

@@ -31,7 +31,7 @@ class ResponseTest extends TestCase {
  */
 	public function setUp() {
 		parent::setUp();
-		ob_start();
+		include_once __DIR__ . DS . 'mocks.php';
 	}
 
 /**
@@ -41,7 +41,6 @@ class ResponseTest extends TestCase {
  */
 	public function tearDown() {
 		parent::tearDown();
-		ob_end_clean();
 	}
 
 /**

+ 28 - 0
tests/TestCase/Network/mocks.php

@@ -0,0 +1,28 @@
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @since         3.0.0
+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+
+namespace Cake\Network {
+
+/**
+ * Mocks the headers_sent() function when invoked from the Cake\Network
+ * namespace so that it always return false
+ *
+ * @return boolean
+ */
+	function headers_sent() {
+		return false;
+	}
+
+}