示例#1
0
 public function testSubActions()
 {
     /* If a controller action returns another controller, ensure that the $action variable is correctly forwarded */
     $response = $this->get("ControllerTest_ContainerController/subcontroller/subaction");
     $this->assertEquals('subaction', $response->getBody());
     $request = new SS_HTTPRequest('GET', 'ControllerTest_ContainerController/subcontroller/substring/subvieweraction');
     /* Shift to emulate the director selecting the controller */
     $request->shift();
     /* Handle the request to create conditions where improperly passing the action to the viewer might fail */
     $controller = new ControllerTest_ContainerController();
     try {
         $controller->handleRequest($request, DataModel::inst());
     } catch (ControllerTest_SubController_Exception $e) {
         $this->fail($e->getMessage());
     }
 }