Navigation Menu

Skip to content

Commit

Permalink
Fix failing tests from 2.x merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jan 30, 2014
1 parent fc1ffd6 commit b0a9e0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Network/Response.php
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/Network/ResponseTest.php
Expand Up @@ -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
Expand All @@ -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());
Expand All @@ -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')
Expand Down

0 comments on commit b0a9e0d

Please sign in to comment.