diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index f6f4ea574..6e2b70350 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -538,9 +538,10 @@ class RequestHandlerComponent extends Object { $this->respondAs($type); } - if (!in_array(ucfirst($type), $controller->helpers)) { - if (file_exists(HELPERS . $type . '.php') || fileExistsInPath(LIBS . 'view' . DS . 'helpers' . DS . $type . '.php')) { - $controller->helpers[] = ucfirst($type); + $helper = ucfirst($type); + if (!in_array($helper, $controller->helpers)) { + if (App::import('Helper', $helper)) { + $controller->helpers[] = $helper; } } } diff --git a/cake/tests/cases/libs/controller/components/request_handler.test.php b/cake/tests/cases/libs/controller/components/request_handler.test.php index 6c6b9dba7..84dd9e0de 100644 --- a/cake/tests/cases/libs/controller/components/request_handler.test.php +++ b/cake/tests/cases/libs/controller/components/request_handler.test.php @@ -26,7 +26,7 @@ * @lastmodified $Date$ * @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. * @@ -35,8 +35,19 @@ uses('controller' . DS . 'components' . DS .'request_handler'); */ class RequestHandlerComponentTest extends CakeTestCase { - function skip() { - $this->skipif (true, 'RequestHandlerComponentTest not implemented'); + function setUp() { + $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); } } ?> \ No newline at end of file