Inheritance: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
 public function testGetControllerMatchedView()
 {
     $id = 123;
     $viewType = 'full';
     $templateIdentifier = 'FooBundle:full:template.twig.html';
     $customController = 'FooBundle::bar';
     $this->request->attributes->add(array('_controller' => 'ez_content:viewLocation', 'locationId' => $id, 'viewType' => $viewType));
     $this->viewBuilderRegistry->expects($this->once())->method('getFromRegistry')->will($this->returnValue($this->viewBuilderMock));
     $viewObject = new ContentView($templateIdentifier);
     $viewObject->setControllerReference(new ControllerReference($customController));
     $this->viewBuilderMock->expects($this->once())->method('buildView')->will($this->returnValue($viewObject));
     $this->event->expects($this->once())->method('setController');
     $this->controllerResolver->expects($this->once())->method('getController')->will($this->returnValue(function () {
     }));
     $this->controllerListener->getController($this->event);
     $this->assertEquals($customController, $this->request->attributes->get('_controller'));
     $expectedView = new ContentView();
     $expectedView->setTemplateIdentifier($templateIdentifier);
     $expectedView->setControllerReference(new ControllerReference($customController));
     $this->assertEquals($expectedView, $this->request->attributes->get('view'));
 }
 public function testGetControllerContentInfo()
 {
     $id = 123;
     $contentInfo = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\ContentInfo')->setConstructorArgs(array(array('id' => $id)))->getMockForAbstractClass();
     $viewType = 'full';
     $this->request->attributes->add(array('_controller' => 'ez_content:viewLocation', 'contentInfo' => $contentInfo, 'viewType' => $viewType));
     $this->repository->expects($this->never())->method('getContentService');
     $controllerIdentifier = 'AcmeTestBundle:Default:foo';
     $controllerCallable = 'DefaultController::fooAction';
     $controllerReference = new ControllerReference($controllerIdentifier);
     $this->controllerManager->expects($this->once())->method('getControllerReference')->with($contentInfo, $viewType)->will($this->returnValue($controllerReference));
     $this->controllerResolver->expects($this->once())->method('getController')->with($this->request)->will($this->returnValue($controllerCallable));
     $this->event->expects($this->once())->method('setController')->with($controllerCallable);
     $this->assertNull($this->controllerListener->getController($this->event));
     $this->assertSame($controllerIdentifier, $this->request->attributes->get('_controller'));
     $this->assertSame($id, $this->request->attributes->get('contentId'));
 }