mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
allowing RequestHandler to load helpers for extension from any path, closes #2230
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6141 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
b7a0d4b31e
commit
b6b2696488
2 changed files with 18 additions and 6 deletions
|
@ -538,9 +538,10 @@ class RequestHandlerComponent extends Object {
|
||||||
$this->respondAs($type);
|
$this->respondAs($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array(ucfirst($type), $controller->helpers)) {
|
$helper = ucfirst($type);
|
||||||
if (file_exists(HELPERS . $type . '.php') || fileExistsInPath(LIBS . 'view' . DS . 'helpers' . DS . $type . '.php')) {
|
if (!in_array($helper, $controller->helpers)) {
|
||||||
$controller->helpers[] = ucfirst($type);
|
if (App::import('Helper', $helper)) {
|
||||||
|
$controller->helpers[] = $helper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* @lastmodified $Date$
|
* @lastmodified $Date$
|
||||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
*/
|
*/
|
||||||
uses('controller' . DS . 'components' . DS .'request_handler');
|
uses('controller' . DS . 'controller', 'controller' . DS . 'components' . DS .'request_handler');
|
||||||
/**
|
/**
|
||||||
* Short description for class.
|
* Short description for class.
|
||||||
*
|
*
|
||||||
|
@ -35,8 +35,19 @@ uses('controller' . DS . 'components' . DS .'request_handler');
|
||||||
*/
|
*/
|
||||||
class RequestHandlerComponentTest extends CakeTestCase {
|
class RequestHandlerComponentTest extends CakeTestCase {
|
||||||
|
|
||||||
function skip() {
|
function setUp() {
|
||||||
$this->skipif (true, 'RequestHandlerComponentTest not implemented');
|
$this->RequestHandler = new RequestHandlerComponent();
|
||||||
|
$this->Controller = new Controller();
|
||||||
|
}
|
||||||
|
|
||||||
|
function testRenderAs() {
|
||||||
|
$this->RequestHandler->renderAs($this->Controller, 'xml');
|
||||||
|
$this->assertEqual($this->Controller->helpers, array('Html', 'Xml'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function tearDown() {
|
||||||
|
unset($this->RequestHandler);
|
||||||
|
unset($this->Controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue