Skip to content

Commit

Permalink
Update IntegrationTestCase::_buildRequest
Browse files Browse the repository at this point in the history
Hi,

I'm not sure it's the better way to do this but, the method is currently not use in this method.
I'm tried to test my controller. #4606

When i used __$this->put('/actions/changeStatus/1.json', ['status_id' => 2])__. But on the action of the controller, the request don't have a variable environment __REQUEST_METHOD__.

So these lines above resolve this problem.

Jason.
  • Loading branch information
rapsspider committed Sep 14, 2014
1 parent e73884c commit ae4a87a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/TestSuite/IntegrationTestCase.php
Expand Up @@ -320,14 +320,15 @@ protected function _buildRequest($url, $method, $data) {
'cookies' => $this->_cookie,
'session' => $session,
];
$env[];
if (isset($this->_request['headers'])) {
$env = [];
foreach ($this->_request['headers'] as $k => $v) {
$env['HTTP_' . str_replace('-', '_', strtoupper($k))] = $v;
}
$props['environment'] = $env;
unset($this->_request['headers']);
}
$env['REQUEST_METHOD'] = $method;
$props['environment'] = $env;
$props += $this->_request;
return new Request($props);
}
Expand Down

0 comments on commit ae4a87a

Please sign in to comment.