Permalink
Browse files

Adding ability to set configuration from initialize() for RequestHand…

…ler.

Tests added.
  • Loading branch information...
1 parent 5760f41 commit ff74a599c6a875253069ec60294435c38bdcbe52 @markstory markstory committed Dec 17, 2009
@@ -165,14 +165,16 @@ function __construct() {
* as the first item.
*
* @param object $controller A reference to the controller
+ * @param array $settings Array of settings to _set().
* @return void
* @see Router::parseExtensions()
* @access public
*/
- function initialize(&$controller) {
+ function initialize(&$controller, $settings = array()) {
if (isset($controller->params['url']['ext'])) {
$this->ext = $controller->params['url']['ext'];
}
+ $this->_set($settings);
}
/**
@@ -186,6 +186,12 @@ function testInitializeCallback() {
$this->Controller->params['url']['ext'] = 'rss';
$this->RequestHandler->initialize($this->Controller);
$this->assertEqual($this->RequestHandler->ext, 'rss');
+
+ $settings = array(
+ 'ajaxLayout' => 'test_ajax'
+ );
+ $this->RequestHandler->initialize($this->Controller, $settings);
+ $this->assertEqual($this->RequestHandler->ajaxLayout, 'test_ajax');
}
/**

0 comments on commit ff74a59

Please sign in to comment.