17 import(
'lib.pkp.tests.PKPTestCase');
18 import(
'lib.pkp.classes.core.Registry');
19 import(
'classes.core.Application');
20 import(
'lib.pkp.classes.core.Dispatcher');
21 import(
'lib.pkp.classes.core.PKPRequest');
22 import(
'lib.pkp.classes.plugins.HookRegistry');
37 return array(
'application',
'dispatcher');
43 protected function setUp() : void {
47 $mockApplication = $this->getMockBuilder(Application::class)
48 ->setMethods(array(
'getContextDepth',
'getContextList'))
52 $mockApplication->expects($this->any())
53 ->method(
'getContextDepth')
54 ->will($this->returnValue(2));
57 $mockApplication->expects($this->any())
58 ->method(
'getContextList')
59 ->will($this->returnValue(array(
'firstContext',
'secondContext')));
61 $this->dispatcher = $mockApplication->getDispatcher();
62 $this->dispatcher->addRouterName(
'lib.pkp.classes.core.PKPPageRouter',
'page');
71 if (
Config::getVar(
'general',
'disable_path_info')) $this->markTestSkipped();
72 $baseUrl = $this->request->getBaseUrl();
74 $url = $this->dispatcher->url($this->request, ROUTE_PAGE, array(
'context1',
'context2'),
'somepage',
'someop');
75 self::assertEquals($baseUrl.
'/index.php/context1/context2/somepage/someop', $url);
77 $url = $this->dispatcher->url($this->request, ROUTE_COMPONENT, array(
'context1',
'context2'),
'some.ComponentHandler',
'someOp');
78 self::assertEquals($baseUrl.
'/index.php/context1/context2/$$$call$$$/some/component/some-op', $url);