コード例 #1
0
 /**
  * testDisabling method
  *
  * @return void
  */
 public function testDisabling()
 {
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     $this->_init();
     $this->RequestHandler->initialize($this->Controller);
     $this->Controller->beforeFilter();
     $this->RequestHandler->startup($this->Controller);
     $this->assertEquals(true, $this->Controller->params['isAjax']);
 }
 /**
  * testDisabling method
  *
  * @access public
  * @return void
  */
 function testDisabling()
 {
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     $this->_init();
     $this->Controller->Component->initialize($this->Controller);
     $this->Controller->beforeFilter();
     $this->Controller->Component->startup($this->Controller);
     $this->assertEqual($this->Controller->params, array('isAjax' => true));
     $this->Controller = new RequestHandlerTestDisabledController(array('components' => array('RequestHandler')));
     $this->Controller->constructClasses();
     $this->Controller->Component->initialize($this->Controller);
     $this->Controller->beforeFilter();
     $this->Controller->Component->startup($this->Controller);
     $this->assertEqual($this->Controller->params, array());
     unset($_SERVER['HTTP_X_REQUESTED_WITH']);
 }
コード例 #3
0
 /**
  * init method
  *
  * @access protected
  * @return void
  */
 function _init()
 {
     $this->Controller = new RequestHandlerTestController(array('components' => array('RequestHandler')));
     $this->Controller->constructClasses();
     $this->RequestHandler =& $this->Controller->RequestHandler;
 }