protected function &getFrontcontrollerActions()
 {
     $actions = [];
     $action = new TestFrontControllerAction();
     $action->setActionNamespace($this->actionNamespace);
     $action->setActionName($this->actionName);
     $action->setKeepInUrl(true);
     // to test action inclusion
     $action->setInput(new FrontcontrollerInput());
     $actions[] = $action;
     return $actions;
 }
 protected function &getFrontcontrollerActions()
 {
     $actions = [];
     $action = new TestFrontControllerAction();
     $action->setActionNamespace('APF\\cms\\core\\biz\\setmodel');
     $action->setActionName('setModel');
     $action->setKeepInUrl(true);
     // to test action inclusion
     $input = new FrontcontrollerInput();
     $input->setParameter('page.config.section', 'external');
     $action->setInput($input);
     $actions[] = $action;
     return $actions;
 }
예제 #3
0
 /**
  * Tests link generation with multiple mapped actions.
  */
 public function testMultipleMappedActions()
 {
     $standardScheme = new MultipleMappedActionsTestableStandardLinkScheme();
     $rewriteScheme = new MultipleMappedActionsTestableRewriteLinkScheme();
     // provokes test for naming collision!
     $fooMapping = new ActionUrlMapping('foo', 'VENDOR\\foo', 'say-foo');
     $standardScheme->addActionMapping($fooMapping);
     $rewriteScheme->addActionMapping($fooMapping);
     $fooAction = new TestFrontControllerAction();
     $fooAction->setActionName('say-foo');
     $fooAction->setActionNamespace('VENDOR\\foo');
     $fooAction->setKeepInUrl(true);
     $standardScheme->addAction($fooAction);
     $rewriteScheme->addAction($fooAction);
     // provokes test for naming collision!
     $barMapping = new ActionUrlMapping('bar', 'VENDOR\\bar', 'say-bar');
     $standardScheme->addActionMapping($barMapping);
     $rewriteScheme->addActionMapping($barMapping);
     $barAction = new TestFrontControllerAction();
     $barAction->setActionName('say-bar');
     $barAction->setActionNamespace('VENDOR\\bar');
     $barAction->setKeepInUrl(true);
     $standardScheme->addAction($barAction);
     $rewriteScheme->addAction($barAction);
     // simple normal URL containing mapped actions - w/o params
     $url = new Url(null, null, null, '/categories');
     $link = LinkGenerator::generateUrl($url, $standardScheme);
     $this->assertEquals('/categories?foo&bar', $link);
     // simple rewrite URL containing mapped actions - w/o params
     $url = new Url(null, null, null, null);
     $link = LinkGenerator::generateUrl($url, $rewriteScheme);
     $this->assertEquals('/~/foo/~/bar', $link);
     // normal action URL containing mapped actions - w/o params
     $url = new Url(null, null, null, '/categories');
     $link = LinkGenerator::generateActionUrl($url, 'VENDOR\\baz', 'say-baz', [], $standardScheme);
     $this->assertEquals('/categories?VENDOR_baz-action:say-baz&foo&bar', $link);
     // rewrite action URL containing mapped actions - w/o params
     $url = new Url(null, null, null, null);
     $link = LinkGenerator::generateActionUrl($url, 'VENDOR\\baz', 'say-baz', [], $rewriteScheme);
     $this->assertEquals('/~/VENDOR_baz-action/say-baz/~/foo/~/bar', $link);
     // simple normal URL containing mapped actions - w/ params
     $url = new Url(null, null, null, '/categories', ['one' => '1', 'two' => '2']);
     $link = LinkGenerator::generateUrl($url, $standardScheme);
     $this->assertEquals('/categories?one=1&two=2&foo&bar', $link);
     // simple rewrite URL containing mapped actions - w/ params
     $url = new Url(null, null, null, null, ['one' => '1', 'two' => '2']);
     $link = LinkGenerator::generateUrl($url, $rewriteScheme);
     $this->assertEquals('/one/1/two/2/~/foo/~/bar', $link);
     // normal action URL containing mapped actions - w/ params
     $url = new Url(null, null, null, '/categories', ['one' => '1', 'two' => '2']);
     $link = LinkGenerator::generateActionUrl($url, 'VENDOR\\baz', 'say-baz', [], $standardScheme);
     $this->assertEquals('/categories?one=1&two=2&VENDOR_baz-action:say-baz&foo&bar', $link);
     // rewrite action URL containing mapped actions - w/ params
     $url = new Url(null, null, null, null, ['one' => '1', 'two' => '2']);
     $link = LinkGenerator::generateActionUrl($url, 'VENDOR\\baz', 'say-baz', [], $rewriteScheme);
     $this->assertEquals('/one/1/two/2/~/VENDOR_baz-action/say-baz/~/foo/~/bar', $link);
 }