/** * Returns the test controller * * @param \Cake\Network\Request $request Request object * @param \Cake\Network\Response $response Response for the controller. * @return \Cake\Controller\Controller */ protected function _getController($request, $response) { if ($this->testController === null) { $this->testController = parent::_getController($request, $response); } $default = array('InterceptContent' => array('className' => 'Cake\\TestSuite\\InterceptContentHelper')); $this->testController->helpers = array_merge($default, $this->testController->helpers); $this->testController->setRequest($request); $this->testController->response = $this->response; $registry = $this->testController->components(); foreach ($registry->loaded() as $component) { $object = $registry->{$component}; if (isset($object->response)) { $object->response = $response; } if (isset($object->request)) { $object->request = $request; } } return $this->testController; }