/** * @test * @author Sebastian Kurfürst <*****@*****.**> */ public function multipleEvaluateCallsShareTheSameViewHelperInstance() { $mockViewHelper = $this->getMock('F3\\Fluid\\Core\\ViewHelper\\AbstractViewHelper', array('render', 'validateArguments', 'prepareArguments', 'setViewHelperVariableContainer')); $mockViewHelper->expects($this->any())->method('render')->will($this->returnValue('String')); $viewHelperNode = new \F3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode($mockViewHelper, array()); $mockViewHelperArguments = $this->getMock('F3\\Fluid\\Core\\ViewHelper\\Arguments', array(), array(), '', FALSE); $this->mockObjectFactory->expects($this->at(0))->method('create')->with('F3\\Fluid\\Core\\ViewHelper\\Arguments')->will($this->returnValue($mockViewHelperArguments)); $this->mockObjectFactory->expects($this->at(1))->method('create')->with('F3\\Fluid\\Core\\ViewHelper\\Arguments')->will($this->returnValue($mockViewHelperArguments)); $viewHelperNode->setRenderingContext($this->renderingContext); $viewHelperNode->evaluate(); $viewHelperNode->evaluate(); }
/** * Initializes the security context for the given request. It is loaded from the session. * * @param F3\FLOW3\MVC\RequestInterface $request The request the context should be initialized for * @return void * @author Andreas Förthner <*****@*****.**> * @author Karsten Dambekalns <*****@*****.**> */ public function initializeContext(\F3\FLOW3\MVC\RequestInterface $request) { if (!$this->context instanceof \F3\FLOW3\Security\Context) { $this->context = $this->objectFactory->create('F3\\FLOW3\\Security\\Context'); } $this->context->setRequest($request); $this->authenticationManager->setSecurityContext($this->context); $managerTokens = $this->filterInactiveTokens($this->authenticationManager->getTokens(), $request); $sessionTokens = $this->context->getAuthenticationTokens(); $mergedTokens = $this->mergeTokens($managerTokens, $sessionTokens); $this->updateTokens($mergedTokens); $this->context->setAuthenticationTokens($mergedTokens); }
/** * Converts the given string or array to a Resource object. * * If the input format is an array, this method assumes the resource to be a * fresh file upload and imports the temporary upload file through the * resource manager. * * @param array $source The upload info (expected keys: error, name, tmp_name) * @return object An object or an instance of F3\FLOW3\Error\Error if the input format is not supported or could not be converted for other reasons * @author Robert Lemke <*****@*****.**> * @author Karsten Dambekalns <*****@*****.**> */ public function convertFrom($source) { if (is_array($source)) { if ($source['error'] === \UPLOAD_ERR_NO_FILE) { return NULL; } if ($source['error'] !== \UPLOAD_ERR_OK) { return $this->objectFactory->create('F3\\FLOW3\\Error\\Error', \F3\FLOW3\Utility\Files::getUploadErrorMessage($source['error']), 1264440823); } $resource = $this->resourceManager->importUploadedResource($source); if ($resource === FALSE) { return $this->objectFactory->create('F3\\FLOW3\\Error\\Error', 'The resource manager could not create a resource instance.', 1264517906); } else { return $resource; } } else { return $this->objectFactory->create('F3\\FLOW3\\Error\\Error', 'The source for conversion to a resource object was not an array.', 1264440811); } }