本文整理汇总了PHP中TYPO3\Flow\Mvc\ActionRequest::setDispatched方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionRequest::setDispatched方法的具体用法?PHP ActionRequest::setDispatched怎么用?PHP ActionRequest::setDispatched使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Mvc\ActionRequest
的用法示例。
在下文中一共展示了ActionRequest::setDispatched方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDispatchedEmitsSignalIfDispatched
/**
* @test
*/
public function setDispatchedEmitsSignalIfDispatched()
{
$mockDispatcher = $this->getMock(\TYPO3\Flow\SignalSlot\Dispatcher::class);
$mockDispatcher->expects($this->once())->method('dispatch')->with(\TYPO3\Flow\Mvc\ActionRequest::class, 'requestDispatched', array($this->actionRequest));
$mockObjectManager = $this->getMock(\TYPO3\Flow\Object\ObjectManagerInterface::class);
$mockObjectManager->expects($this->any())->method('get')->will($this->returnValue($mockDispatcher));
$this->inject($this->actionRequest, 'objectManager', $mockObjectManager);
$this->actionRequest->setDispatched(true);
}
示例2: setDispatchedEmitsSignalIfDispatched
/**
* @test
*/
public function setDispatchedEmitsSignalIfDispatched()
{
$mockDispatcher = $this->getMock('TYPO3\\Flow\\SignalSlot\\Dispatcher');
$mockDispatcher->expects($this->once())->method('dispatch')->with('TYPO3\\Flow\\Mvc\\ActionRequest', 'requestDispatched', array($this->actionRequest));
$mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
$mockObjectManager->expects($this->any())->method('get')->will($this->returnValue($mockDispatcher));
$this->inject($this->actionRequest, 'objectManager', $mockObjectManager);
$this->actionRequest->setDispatched(TRUE);
}
示例3: initializeController
/**
* Initializes the controller
*
* This method should be called by the concrete processRequest() method.
*
* @param \TYPO3\Flow\Mvc\RequestInterface $request
* @param \TYPO3\Flow\Mvc\ResponseInterface $response
* @throws \TYPO3\Flow\Mvc\Exception\UnsupportedRequestTypeException
*/
protected function initializeController(\TYPO3\Flow\Mvc\RequestInterface $request, \TYPO3\Flow\Mvc\ResponseInterface $response)
{
if (!$request instanceof ActionRequest) {
throw new \TYPO3\Flow\Mvc\Exception\UnsupportedRequestTypeException(get_class($this) . ' only supports action requests – requests of type "' . get_class($request) . '" given.', 1187701131);
}
$this->request = $request;
$this->request->setDispatched(true);
$this->response = $response;
$this->uriBuilder = new UriBuilder();
$this->uriBuilder->setRequest($this->request);
$this->arguments = new Arguments(array());
$this->controllerContext = new ControllerContext($this->request, $this->response, $this->arguments, $this->uriBuilder);
$mediaType = $request->getHttpRequest()->getNegotiatedMediaType($this->supportedMediaTypes);
if ($mediaType === null) {
$this->throwStatus(406);
}
if ($request->getFormat() === null) {
$this->request->setFormat(MediaTypes::getFilenameExtensionFromMediaType($mediaType));
}
}
示例4: initializeControllerContext
/**
* The Resource Information most likely needs an UriBuilder, so having a
* ControllerContext in place might come in handy.
*
* @return void
*/
protected function initializeControllerContext()
{
$request = new ActionRequest(Request::createFromEnvironment());
$request->setDispatched(true);
$response = new Response();
$uriBuilder = new UriBuilder();
$uriBuilder->setRequest($request);
$arguments = new Arguments(array());
$this->controllerContext = new ControllerContext($request, $response, $arguments, $uriBuilder);
}
示例5: cloneResetsTheStatusToNotDispatched
/**
* @test
*/
public function cloneResetsTheStatusToNotDispatched()
{
$httpRequest = HttpRequest::create(new Uri('http://foo.com'));
$originalRequest = new ActionRequest($httpRequest);
$originalRequest->setDispatched(TRUE);
$cloneRequest = clone $originalRequest;
$this->assertTrue($originalRequest->isDispatched());
$this->assertFalse($cloneRequest->isDispatched());
}