Beispiel #1
0
 /**
  * Setup for tests
  *
  * @return null
  */
 public function setUp()
 {
     $this->mockPageRepo = $this->getMockBuilder('\\Rcm\\Repository\\Page')->disableOriginalConstructor()->getMock();
     $this->mockPageRepo->expects($this->any())->method('getPageByName')->will($this->returnCallback([$this, 'pageRepoMockCallback']));
     $mockLayoutManager = $this->getMockBuilder('\\Rcm\\Service\\LayoutManager')->disableOriginalConstructor()->getMock();
     $mockLayoutManager->expects($this->any())->method('getSiteLayout')->will($this->returnCallback([$this, 'layoutManagerMockCallback']));
     $this->mockUserServicePlugin = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\RcmIsAllowed')->disableOriginalConstructor()->getMock();
     $this->mockIsPageAllowed = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\RcmIsPageAllowed')->disableOriginalConstructor()->getMock();
     $this->mockShouldShowRevisions = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\ShouldShowRevisions')->disableOriginalConstructor()->getMock();
     $this->mockRedirectToPage = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\RedirectToPage')->disableOriginalConstructor()->getMock();
     $this->mockIsSiteAdmin = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\IsSiteAdmin')->disableOriginalConstructor()->getMock();
     $this->currentSite = new Site();
     $this->currentSite->setSiteId(1);
     $this->currentSite->setNotFoundPage('not-found');
     $config = ['contentManager' => ['type' => 'Zend\\Mvc\\Router\\Http\\Segment', 'options' => ['route' => '/rcm[/:page][/:revision]', 'defaults' => ['controller' => 'Rcm\\Controller\\IndexController', 'action' => 'index']]], 'contentManagerWithPageType' => ['type' => 'Zend\\Mvc\\Router\\Http\\Segment', 'options' => ['route' => '/rcm/:pageType/:page[/:revision]', 'constraints' => ['pageType' => '[a-z]'], 'defaults' => ['controller' => 'Rcm\\Controller\\IndexController', 'action' => 'index']]]];
     /** @var \Rcm\Service\LayoutManager $mockLayoutManager */
     $this->controller = new IndexController($mockLayoutManager, $this->currentSite, $this->mockPageRepo);
     $this->controller->getPluginManager()->setService('rcmIsAllowed', $this->mockUserServicePlugin)->setService('shouldShowRevisions', $this->mockShouldShowRevisions)->setService('redirectToPage', $this->mockRedirectToPage)->setService('rcmIsSiteAdmin', $this->mockIsSiteAdmin)->setService('rcmIsPageAllowed', $this->mockIsPageAllowed);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(['controller' => 'index']);
     $this->event = new MvcEvent();
     $routerConfig = $config;
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
 }
Beispiel #2
0
 /**
  * Setup for tests
  *
  * @return null
  */
 public function setUp()
 {
     $config = ['Rcm\\Api\\Page\\Check' => ['type' => 'Segment', 'options' => ['route' => '/rcm/page/check[/:pageType]/:pageId', 'defaults' => ['controller' => 'Rcm\\Controller\\PageCheckController']]]];
     $this->mockPageValidator = $this->getMockBuilder('\\Rcm\\Validator\\Page')->disableOriginalConstructor()->getMock();
     $serviceManager = new ServiceManager();
     $serviceManager->setService('Rcm\\Validator\\Page', $this->mockPageValidator);
     /** @var \Rcm\Service\LayoutManager $mockLayoutManager */
     $this->controller = new PageCheckController($serviceManager);
     $this->request = new Request();
     $this->request->setMethod('GET');
     $this->routeMatch = new RouteMatch(['controller' => 'Rcm\\Controller\\PageCheckController']);
     $this->event = new MvcEvent();
     $routerConfig = $config;
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
 }