本文整理匯總了PHP中zibo\core\Zibo::setRouter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zibo::setRouter方法的具體用法?PHP Zibo::setRouter怎麽用?PHP Zibo::setRouter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zibo\core\Zibo
的用法示例。
在下文中一共展示了Zibo::setRouter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testMainWithChainedRequests
public function testMainWithChainedRequests()
{
$routerMock = $this->getMock('zibo\\core\\router\\Router', array('getRequest', 'getRoutes', 'getAliases'));
$routerMockCall = $routerMock->expects($this->once());
$routerMockCall->method('getRequest');
$routerMockCall->will($this->returnValue(new Request('', '', 'zibo\\core\\TestController', 'chainAction')));
$zibo = new Zibo($this->getBrowserMock(), $this->getConfigIOMock());
$zibo->setRouter($routerMock);
$zibo->setDispatcher(new GenericDispatcher($zibo, new ObjectFactory()));
$zibo->main();
$this->assertEquals(array('chain', 'index'), TestController::$actions);
}
示例2: setDefaultAction
/**
* Sets the default action and controller to the router
* @param zibo\core\Zibo $zibo
* @return null
*/
private function setDefaultAction(Zibo $zibo)
{
$router = $zibo->getRouter();
if ($router === null) {
$router = new GenericRouter();
$zibo->setRouter($router);
}
if (!$router instanceof GenericRouter) {
return;
}
$defaultController = $router->getDefaultController();
if ($defaultController) {
return;
}
$defaultController = $zibo->getConfigValue(self::CONFIG_CONTROLLER_DEFAULT, self::CONTROLLER_DEFAULT);
$router->setDefaultAction($defaultController);
}