mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Updating RequestHandler::renderAs() to respect DS constant, fixing issues on PHP4 + Windows. Fixes #97
This commit is contained in:
parent
e04cc81613
commit
e5a99b2685
2 changed files with 4 additions and 4 deletions
|
@ -583,9 +583,9 @@ class RequestHandlerComponent extends Object {
|
||||||
$controller->ext = '.ctp';
|
$controller->ext = '.ctp';
|
||||||
|
|
||||||
if (empty($this->__renderType)) {
|
if (empty($this->__renderType)) {
|
||||||
$controller->viewPath .= '/' . $type;
|
$controller->viewPath .= DS . $type;
|
||||||
} else {
|
} else {
|
||||||
$remove = preg_replace("/(?:\/{$this->__renderType})$/", '/' . $type, $controller->viewPath);
|
$remove = preg_replace("/([\/\\\\]{$this->__renderType})$/", DS . $type, $controller->viewPath);
|
||||||
$controller->viewPath = $remove;
|
$controller->viewPath = $remove;
|
||||||
}
|
}
|
||||||
$this->__renderType = $type;
|
$this->__renderType = $type;
|
||||||
|
|
|
@ -267,13 +267,13 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
||||||
**/
|
**/
|
||||||
function testRenderAsCalledTwice() {
|
function testRenderAsCalledTwice() {
|
||||||
$this->RequestHandler->renderAs($this->Controller, 'xml');
|
$this->RequestHandler->renderAs($this->Controller, 'xml');
|
||||||
$this->assertEqual($this->Controller->viewPath, 'request_handler_test/xml');
|
$this->assertEqual($this->Controller->viewPath, 'request_handler_test' . DS . 'xml');
|
||||||
$this->assertEqual($this->Controller->layoutPath, 'xml');
|
$this->assertEqual($this->Controller->layoutPath, 'xml');
|
||||||
|
|
||||||
$this->assertTrue(in_array('Xml', $this->Controller->helpers));
|
$this->assertTrue(in_array('Xml', $this->Controller->helpers));
|
||||||
|
|
||||||
$this->RequestHandler->renderAs($this->Controller, 'js');
|
$this->RequestHandler->renderAs($this->Controller, 'js');
|
||||||
$this->assertEqual($this->Controller->viewPath, 'request_handler_test/js');
|
$this->assertEqual($this->Controller->viewPath, 'request_handler_test' . DS . 'js');
|
||||||
$this->assertEqual($this->Controller->layoutPath, 'js');
|
$this->assertEqual($this->Controller->layoutPath, 'js');
|
||||||
$this->assertTrue(in_array('Js', $this->Controller->helpers));
|
$this->assertTrue(in_array('Js', $this->Controller->helpers));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue