本文整理汇总了PHP中CController::actions方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::actions方法的具体用法?PHP CController::actions怎么用?PHP CController::actions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CController
的用法示例。
在下文中一共展示了CController::actions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDefaultProperties
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: createActionInstances
/**
* 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;
}