예제 #1
0
 public function testDefaultProperties()
 {
     $app = new TestApplication();
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $c = new CController('test/subtest');
     $this->assertEquals($c->id, 'test/subtest');
     $this->assertEquals($c->filters(), array());
     $this->assertEquals($c->actions(), array());
     $this->assertNull($c->action);
     $this->assertEquals($c->defaultAction, 'index');
     $this->assertEquals($c->viewPath, $app->viewPath . DIRECTORY_SEPARATOR . 'test/subtest');
     $this->setExpectedException('CHttpException');
     $c->missingAction('index');
 }
예제 #2
0
파일: Schema.php 프로젝트: codemix/restyii
 /**
  * Creates the action instances for the given controller
  * @param \CController $controller the controller to get actions for
  *
  * @return \CAction[] the controller actions
  */
 protected function createActionInstances(\CController $controller)
 {
     $actions = array();
     foreach ($controller->actions() as $id => $config) {
         $actions[$id] = $controller->createAction($id);
     }
     $reflector = new \ReflectionObject($controller);
     foreach ($reflector->getMethods() as $name => $method) {
         if ($name != 'actions' && substr($name, 0, 6) == 'action') {
             $id = lcfirst(substr($name, 6));
             $actions[$id] = $controller->createAction($id);
         }
     }
     return $actions;
 }