This knows about the ControllerContext and ObjectManager.
Inheritance: extends TYPO3Fluid\Fluid\Core\Rendering\RenderingContext, implements Neos\FluidAdaptor\Core\Rendering\FlowAwareRenderingContextInterface
コード例 #1
0
 /**
  * Sets up this test case
  *
  * @return void
  */
 public function setUp()
 {
     $this->templateVariableContainer = $this->getMockBuilder(TemplateVariableContainer::class)->setMethods(array('exists', 'remove', 'add'))->getMock();
     $this->viewHelperVariableContainer = $this->getMockBuilder(ViewHelperVariableContainer::class)->setMethods(array('setView'))->getMock();
     $this->renderingContext = $this->getMockBuilder(RenderingContext::class)->setMethods(array('getViewHelperVariableContainer', 'getVariableProvider'))->disableOriginalConstructor()->getMock();
     $this->renderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->viewHelperVariableContainer));
     $this->renderingContext->expects($this->any())->method('getVariableProvider')->will($this->returnValue($this->templateVariableContainer));
     $this->view = $this->getMockBuilder(AbstractTemplateView::class)->setMethods(array('getTemplateSource', 'getLayoutSource', 'getPartialSource', 'canRender', 'getTemplateIdentifier', 'getLayoutIdentifier', 'getPartialIdentifier'))->getMock();
     $this->view->setRenderingContext($this->renderingContext);
 }
コード例 #2
0
 /**
  * Set default options based on the supportedOptions provided
  *
  * @param array $options
  * @throws Exception
  */
 public function __construct(array $options = null)
 {
     if ($options === null) {
         $options = [];
     }
     $this->validateOptions($options);
     $this->setOptions($options);
     $context = new RenderingContext($this, $this->options);
     $context->setControllerName('Default');
     $context->setControllerAction('Default');
     $this->setRenderingContext($context);
 }
コード例 #3
0
 /**
  * @return void
  */
 public function setUp()
 {
     $this->viewHelperVariableContainer = $this->createMock(\TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer::class);
     $this->viewHelperVariableContainer->expects($this->any())->method('exists')->will($this->returnCallback(array($this, 'viewHelperVariableContainerExistsCallback')));
     $this->viewHelperVariableContainer->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'viewHelperVariableContainerGetCallback')));
     $this->templateVariableContainer = $this->createMock(TemplateVariableContainer::class);
     $this->uriBuilder = $this->createMock(\Neos\Flow\Mvc\Routing\UriBuilder::class);
     $this->uriBuilder->expects($this->any())->method('reset')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setArguments')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setSection')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setFormat')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setCreateAbsoluteUri')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setAddQueryString')->will($this->returnValue($this->uriBuilder));
     $this->uriBuilder->expects($this->any())->method('setArgumentsToBeExcludedFromQueryString')->will($this->returnValue($this->uriBuilder));
     // BACKPORTER TOKEN #1
     $httpRequest = \Neos\Flow\Http\Request::create(new \Neos\Flow\Http\Uri('http://localhost/foo'));
     $this->request = $this->getMockBuilder(\Neos\Flow\Mvc\ActionRequest::class)->setConstructorArgs(array($httpRequest))->getMock();
     $this->request->expects($this->any())->method('isMainRequest')->will($this->returnValue(true));
     $this->controllerContext = $this->getMockBuilder(\Neos\Flow\Mvc\Controller\ControllerContext::class)->disableOriginalConstructor()->getMock();
     $this->controllerContext->expects($this->any())->method('getUriBuilder')->will($this->returnValue($this->uriBuilder));
     $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
     $this->tagBuilder = $this->createMock(TagBuilder::class);
     $this->arguments = array();
     $this->renderingContext = new \Neos\FluidAdaptor\Core\Rendering\RenderingContext(new StandaloneView(), []);
     $this->renderingContext->setVariableProvider($this->templateVariableContainer);
     $this->renderingContext->setViewHelperVariableContainer($this->viewHelperVariableContainer);
     $this->renderingContext->setControllerContext($this->controllerContext);
 }
コード例 #4
0
 /**
  * @param RenderingContext $renderingContext
  * @return PrivilegeManagerInterface
  */
 protected static function getPrivilegeManager(RenderingContext $renderingContext)
 {
     $objectManager = $renderingContext->getObjectManager();
     return $objectManager->get(PrivilegeManagerInterface::class);
 }