Example #1
0
 /**
  * Test the index controller attempts to fetch the index or home page with
  * revision but user is not allowed to see revisions
  *
  * @return null
  * @covers Rcm\Controller\IndexController
  */
 public function testIndexActionHomePageRedirectWhenUserNotAllowedForRevisions()
 {
     $this->pageData = $this->getPageData(42, 'my-test', 443, 'z');
     $this->routeMatch->setParam('action', 'index');
     $this->routeMatch->setParam('page', 'my-test');
     $this->routeMatch->setParam('pageType', 'z');
     $this->routeMatch->setParam('revision', 443);
     $response = $this->controller->getResponse();
     $response->getHeaders()->addHeaderLine('Location', '/my-test');
     $response->setStatusCode(302);
     $this->mockIsPageAllowed->expects($this->any())->method('__invoke')->will($this->returnValue(true));
     $mockRedirectToPage = $this->getMockBuilder('\\Rcm\\Controller\\Plugin\\RedirectToPage')->disableOriginalConstructor()->getMock();
     $mockRedirectToPage->expects($this->any())->method('__invoke')->with($this->equalTo('my-test'), $this->equalTo('z'))->will($this->returnValue($response));
     $this->controller->getPluginManager()->setService('redirectToPage', $mockRedirectToPage);
     $result = $this->controller->dispatch($this->request);
     // Assertions needed
 }