本文整理汇总了PHP中TYPO3\Flow\Http\Request::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::expects方法的具体用法?PHP Request::expects怎么用?PHP Request::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Http\Request
的用法示例。
在下文中一共展示了Request::expects方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->mockHttpRequest = $this->getMockBuilder(\TYPO3\Flow\Http\Request::class)->disableOriginalConstructor()->getMock();
$this->mockHttpRequest->expects($this->any())->method('getNegotiatedMediaType')->will($this->returnValue('text/html'));
$this->mockHttpResponse = $this->getMockBuilder(\TYPO3\Flow\Http\Response::class)->getMock();
$this->mockActionRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
$this->mockActionRequest->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest));
}
示例2: setUp
public function setUp()
{
$this->fileSystemTarget = new FileSystemTarget('test');
$this->mockBootstrap = $this->getMockBuilder(Bootstrap::class)->disableOriginalConstructor()->getMock();
$this->mockRequestHandler = $this->getMockBuilder(HttpRequestHandlerInterface::class)->getMock();
$this->mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
$this->mockHttpRequest->expects($this->any())->method('getBaseUri')->will($this->returnValue(new Uri('http://detected/base/uri/')));
$this->mockRequestHandler->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest));
$this->mockBootstrap->expects($this->any())->method('getActiveRequestHandler')->will($this->returnValue($this->mockRequestHandler));
$this->inject($this->fileSystemTarget, 'bootstrap', $this->mockBootstrap);
}
示例3: updateCredentialsIgnoresAnythingOtherThanPostRequests
/**
* @test
*/
public function updateCredentialsIgnoresAnythingOtherThanPostRequests()
{
$arguments = array();
$arguments['__authentication']['TYPO3']['Flow']['Security']['Authentication']['Token']['PasswordToken']['password'] = 'verysecurepassword';
$this->mockHttpRequest->expects($this->atLeastOnce())->method('getMethod')->will($this->returnValue('POST'));
$this->mockActionRequest->expects($this->atLeastOnce())->method('getInternalArguments')->will($this->returnValue($arguments));
$this->token->updateCredentials($this->mockActionRequest);
$this->assertEquals(array('password' => 'verysecurepassword'), $this->token->getCredentials());
$secondToken = new PasswordToken();
$secondMockActionRequest = $this->getMockBuilder(\TYPO3\Flow\Mvc\ActionRequest::class)->disableOriginalConstructor()->getMock();
$secondMockHttpRequest = $this->getMockBuilder(\TYPO3\Flow\Http\Request::class)->disableOriginalConstructor()->getMock();
$secondMockActionRequest->expects($this->any())->method('getHttpRequest')->will($this->returnValue($secondMockHttpRequest));
$secondMockHttpRequest->expects($this->atLeastOnce())->method('getMethod')->will($this->returnValue('GET'));
$secondToken->updateCredentials($secondMockActionRequest);
$this->assertEquals(array('password' => ''), $secondToken->getCredentials());
}
示例4: handleMergesInternalArgumentsWithRoutingMatchResults
/**
* @test
*/
public function handleMergesInternalArgumentsWithRoutingMatchResults()
{
$this->mockHttpRequest->expects($this->any())->method('getArguments')->will($this->returnValue(array('__internalArgument1' => 'request', '__internalArgument2' => 'request', '__internalArgument3' => 'request')));
$this->mockPropertyMapper->expects($this->any())->method('convert')->with('', 'array', $this->mockPropertyMappingConfiguration)->will($this->returnValue(array('__internalArgument2' => 'requestBody', '__internalArgument3' => 'requestBody')));
$this->mockComponentContext->expects($this->atLeastOnce())->method('getParameter')->with('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'matchResults')->will($this->returnValue(array('__internalArgument3' => 'routing')));
$this->mockActionRequest->expects($this->once())->method('setArguments')->with(array('__internalArgument1' => 'request', '__internalArgument2' => 'requestBody', '__internalArgument3' => 'routing'));
$this->dispatchComponent->handle($this->mockComponentContext);
}
示例5: setUp
/**
* Sets up this test case
*/
public function setUp()
{
$this->routerCachingService = $this->getAccessibleMock(\TYPO3\Flow\Mvc\Routing\RouterCachingService::class, array('dummy'));
$this->mockRouteCache = $this->getMockBuilder(\TYPO3\Flow\Cache\Frontend\VariableFrontend::class)->disableOriginalConstructor()->getMock();
$this->inject($this->routerCachingService, 'routeCache', $this->mockRouteCache);
$this->mockResolveCache = $this->getMockBuilder(\TYPO3\Flow\Cache\Frontend\StringFrontend::class)->disableOriginalConstructor()->getMock();
$this->inject($this->routerCachingService, 'resolveCache', $this->mockResolveCache);
$this->mockPersistenceManager = $this->getMockBuilder(\TYPO3\Flow\Persistence\PersistenceManagerInterface::class)->getMock();
$this->inject($this->routerCachingService, 'persistenceManager', $this->mockPersistenceManager);
$this->mockSystemLogger = $this->getMockBuilder(\TYPO3\Flow\Log\SystemLoggerInterface::class)->getMock();
$this->inject($this->routerCachingService, 'systemLogger', $this->mockSystemLogger);
$this->mockHttpRequest = $this->getMockBuilder(\TYPO3\Flow\Http\Request::class)->disableOriginalConstructor()->getMock();
$this->mockHttpRequest->expects($this->any())->method('getMethod')->will($this->returnValue('GET'));
$this->mockHttpRequest->expects($this->any())->method('getRelativePath')->will($this->returnValue('some/route/path'));
$this->mockUri = $this->getMockBuilder(\TYPO3\Flow\Http\Uri::class)->disableOriginalConstructor()->getMock();
$this->mockUri->expects($this->any())->method('getHost')->will($this->returnValue('subdomain.domain.com'));
$this->mockHttpRequest->expects($this->any())->method('getUri')->will($this->returnValue($this->mockUri));
}
示例6: setUp
/**
* Sets up this test case
*/
public function setUp()
{
$this->routerCachingService = $this->getAccessibleMock('TYPO3\\Flow\\Mvc\\Routing\\RouterCachingService', array('dummy'));
$this->mockFindMatchResultsCache = $this->getMockBuilder('TYPO3\\Flow\\Cache\\Frontend\\VariableFrontend')->disableOriginalConstructor()->getMock();
$this->routerCachingService->_set('findMatchResultsCache', $this->mockFindMatchResultsCache);
$this->mockResolveCache = $this->getMockBuilder('TYPO3\\Flow\\Cache\\Frontend\\StringFrontend')->disableOriginalConstructor()->getMock();
$this->routerCachingService->_set('resolveCache', $this->mockResolveCache);
$this->mockPersistenceManager = $this->getMockBuilder('TYPO3\\Flow\\Persistence\\PersistenceManagerInterface')->getMock();
$this->routerCachingService->_set('persistenceManager', $this->mockPersistenceManager);
$this->mockSystemLogger = $this->getMockBuilder('TYPO3\\Flow\\Log\\SystemLoggerInterface')->getMock();
$this->routerCachingService->_set('systemLogger', $this->mockSystemLogger);
$this->mockHttpRequest = $this->getMockBuilder('TYPO3\\Flow\\Http\\Request')->disableOriginalConstructor()->getMock();
$this->mockHttpRequest->expects($this->any())->method('getMethod')->will($this->returnValue('GET'));
$this->mockHttpRequest->expects($this->any())->method('getRelativePath')->will($this->returnValue('some/route/path'));
$this->mockUri = $this->getMockBuilder('TYPO3\\Flow\\Http\\Uri')->disableOriginalConstructor()->getMock();
$this->mockUri->expects($this->any())->method('getHost')->will($this->returnValue('subdomain.domain.com'));
$this->mockHttpRequest->expects($this->any())->method('getUri')->will($this->returnValue($this->mockUri));
}
示例7: tokenCanBeCastToString
/**
* @test
*/
public function tokenCanBeCastToString()
{
$arguments = array();
$arguments['__authentication']['TYPO3']['Flow']['Security']['Authentication']['Token']['UsernamePassword']['username'] = 'TYPO3.Flow';
$arguments['__authentication']['TYPO3']['Flow']['Security']['Authentication']['Token']['UsernamePassword']['password'] = 'verysecurepassword';
$this->mockHttpRequest->expects($this->atLeastOnce())->method('getMethod')->will($this->returnValue('POST'));
$this->mockActionRequest->expects($this->atLeastOnce())->method('getInternalArguments')->will($this->returnValue($arguments));
$this->token->updateCredentials($this->mockActionRequest);
$this->assertEquals('Username: "TYPO3.Flow"', (string) $this->token);
}
示例8: buildDoesNotPrependsScriptRequestPathIfCreateRelativePathsCompatibilityFlagIsTrue
/**
* @test
*/
public function buildDoesNotPrependsScriptRequestPathIfCreateRelativePathsCompatibilityFlagIsTrue()
{
$this->mockHttpRequest->expects($this->never())->method('getScriptRequestPath');
$this->mockRouter->expects($this->once())->method('resolve')->will($this->returnValue('resolvedUri'));
$this->uriBuilder->setCreateAbsoluteUri(FALSE);
$this->uriBuilder->setCreateRelativePaths(TRUE);
$expectedResult = 'resolvedUri';
$actualResult = $this->uriBuilder->build();
$this->assertEquals($expectedResult, $actualResult);
}
示例9: extractWidgetContextDecodesSerializedWidgetContextIfPresent
/**
* @test
*/
public function extractWidgetContextDecodesSerializedWidgetContextIfPresent()
{
$ajaxWidgetComponent = $this->getAccessibleMock(\TYPO3\Fluid\Core\Widget\AjaxWidgetComponent::class, array('dummy'));
$this->inject($ajaxWidgetComponent, 'hashService', $this->mockHashService);
$mockWidgetContext = 'SomeWidgetContext';
$mockSerializedWidgetContext = base64_encode(serialize($mockWidgetContext));
$mockSerializedWidgetContextWithHmac = $mockSerializedWidgetContext . 'HMAC';
$this->mockHttpRequest->expects($this->at(0))->method('hasArgument')->with('__widgetId')->will($this->returnValue(false));
$this->mockHttpRequest->expects($this->at(1))->method('hasArgument')->with('__widgetContext')->will($this->returnValue(true));
$this->mockHttpRequest->expects($this->atLeastOnce())->method('getArgument')->with('__widgetContext')->will($this->returnValue($mockSerializedWidgetContextWithHmac));
$this->mockHashService->expects($this->atLeastOnce())->method('validateAndStripHmac')->with($mockSerializedWidgetContextWithHmac)->will($this->returnValue($mockSerializedWidgetContext));
$actualResult = $ajaxWidgetComponent->_call('extractWidgetContext', $this->mockHttpRequest);
$this->assertEquals($mockWidgetContext, $actualResult);
}