Permalink
Browse files

Fix failing tests from 2.x merge.

  • Loading branch information...
1 parent fc1ffd6 commit b0a9e0d96ce2a492b124a2708b5bf21ef2193954 @markstory markstory committed Jan 30, 2014
Showing with 7 additions and 7 deletions.
  1. +2 −2 src/Network/Response.php
  2. +5 −5 tests/TestCase/Network/ResponseTest.php
View
@@ -1261,13 +1261,13 @@ public function cookie($options = null) {
* ### Whitelist of URIs
* e.g `cors($request, array('http://www.cakephp.org', '*.google.com', 'https://myproject.github.io'));`
*
- * @param CakeRequest $request Request object
+ * @param Cake\Network\Request $request Request object
* @param string|array $allowedDomains List of allowed domains, see method description for more details
* @param string|array $allowedMethods List of HTTP verbs allowed
* @param string|array $allowedHeaders List of HTTP headers allowed
* @return void
*/
- public function cors(CakeRequest $request, $allowedDomains, $allowedMethods = array(), $allowedHeaders = array()) {
+ public function cors(Request $request, $allowedDomains, $allowedMethods = array(), $allowedHeaders = array()) {
$origin = $request->header('Origin');
if (!$origin) {
return;
@@ -1065,7 +1065,7 @@ public function testCookieSettings() {
* Test CORS
*
* @dataProvider corsData
- * @param CakeRequest $request
+ * @param Request $request
* @param string $origin
* @param string|array $domains
* @param string|array $methods
@@ -1076,9 +1076,9 @@ public function testCookieSettings() {
* @return void
*/
public function testCors($request, $origin, $domains, $methods, $headers, $expectedOrigin, $expectedMethods = false, $expectedHeaders = false) {
- $_SERVER['HTTP_ORIGIN'] = $origin;
+ $request->env('HTTP_ORIGIN', $origin);
- $response = $this->getMock('CakeResponse', array('header'));
+ $response = $this->getMock('Cake\Network\Response', array('header'));
$method = $response->expects(!$expectedOrigin ? $this->never() : $this->at(0))->method('header');
$expectedOrigin && $method->with('Access-Control-Allow-Origin', $expectedOrigin ? $expectedOrigin : $this->anything());
@@ -1105,9 +1105,9 @@ public function testCors($request, $origin, $domains, $methods, $headers, $expec
* @return array
*/
public function corsData() {
- $fooRequest = new CakeRequest();
+ $fooRequest = new Request();
- $secureRequest = $this->getMock('CakeRequest', array('is'));
+ $secureRequest = $this->getMock('Cake\Network\Request', array('is'));
$secureRequest->expects($this->any())
->method('is')
->with('ssl')

0 comments on commit b0a9e0d

Please sign in to comment.