本文整理汇总了PHP中PKPRequest::setRouter方法的典型用法代码示例。如果您正苦于以下问题:PHP PKPRequest::setRouter方法的具体用法?PHP PKPRequest::setRouter怎么用?PHP PKPRequest::setRouter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PKPRequest
的用法示例。
在下文中一共展示了PKPRequest::setRouter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMockRequest
/**
* Instantiate a mock request to the given operation.
* @param $requestedOp string the requested operation
* @param $context mixed a request context to be returned
* by the router.
* @param $user User a user to be put into the registry.
* @return PKPRequest
*/
protected function getMockRequest($requestedOp, $context = null, $user = null)
{
// Mock a request to the permitted operation.
$request = new PKPRequest();
// Mock a router.
$router = $this->getMock('PKPRouter', array('getRequestedOp', 'getContext'));
// Mock the getRequestedOp() method.
$router->expects($this->any())->method('getRequestedOp')->will($this->returnValue($requestedOp));
// Mock the getContext() method.
$router->expects($this->any())->method('getContext')->will($this->returnValue($context));
// Put a user into the registry if one has been
// passed in.
if ($user instanceof User) {
Registry::set('user', $user);
}
$request->setRouter($router);
return $request;
}