本文整理汇总了PHP中eZ\Publish\Core\MVC\ConfigResolverInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigResolverInterface::expects方法的具体用法?PHP ConfigResolverInterface::expects怎么用?PHP ConfigResolverInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\Core\MVC\ConfigResolverInterface
的用法示例。
在下文中一共展示了ConfigResolverInterface::expects方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->ioServiceMock = $this->getMock('eZ\\Publish\\Core\\IO\\IOServiceInterface');
$this->configResolverMock = $this->getMock('eZ\\Publish\\Core\\MVC\\ConfigResolverInterface');
$this->configResolverMock->expects($this->any())->method('getParameter')->with('io.url_prefix')->will($this->returnValue($this->ioUriPrefix));
$this->eventListener = new StreamFileListener($this->ioServiceMock, $this->configResolverMock);
}
示例2: testMatchRequestRegularPathinfo
public function testMatchRequestRegularPathinfo()
{
$matchedParameters = array('_controller' => 'AcmeBundle:myAction');
$pathinfo = '/siteaccess/foo/bar';
$request = Request::create($pathinfo);
$this->configResolver->expects($this->never())->method('getParameter');
/** @var \PHPUnit_Framework_MockObject_MockObject|DefaultRouter $router */
$router = $this->generateRouter(array('match'));
$router->expects($this->once())->method('match')->with($pathinfo)->will($this->returnValue($matchedParameters));
$this->assertSame($matchedParameters, $router->matchRequest($request));
}
示例3: testOnKernelRequest
/**
* @dataProvider onKernelRequestProvider
*/
public function testOnKernelRequest(array $configuredLanguages, array $convertedLocalesValueMap, $expectedLocale)
{
$this->configResolver->expects($this->once())->method('getParameter')->with('languages')->will($this->returnValue($configuredLanguages));
$this->localeConverter->expects($this->atLeastOnce())->method('convertToPOSIX')->will($this->returnValueMap($convertedLocalesValueMap));
$defaultLocale = 'en';
$localeListener = new LocaleListener($defaultLocale);
$localeListener->setConfigResolver($this->configResolver);
$localeListener->setLocaleConverter($this->localeConverter);
$request = new Request();
$localeListener->onKernelRequest(new GetResponseEvent($this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface'), $request, HttpKernelInterface::MASTER_REQUEST));
$this->assertSame($expectedLocale, $request->attributes->get('_locale'));
}
示例4: testOnLegacyKernelWebBuild
/**
* @dataProvider onLegacyKernelWebBuildProvider
*/
public function testOnLegacyKernelWebBuild(array $previousSettings, array $expected)
{
$this->configResolver->expects($this->once())->method('getParameter')->with('legacy_mode')->will($this->returnValue(false));
$event = new PreBuildKernelWebHandlerEvent(new ParameterBag($previousSettings), new Request());
$listener = new Security($this->repository, $this->configResolver, $this->securityContext);
$listener->onLegacyKernelWebBuild($event);
$this->assertSame($expected, $event->getParameters()->all());
}
示例5: testGenerateResponseWithCustomLayout
/**
* @dataProvider generateResponseWithCustomLayoutProvider
*/
public function testGenerateResponseWithCustomLayout($customLayout, $content)
{
$contentWithLayout = "<div id=\"i-am-a-twig-layout\">{$content}</div>";
$moduleResult = array('content' => $content, 'errorCode' => 200);
$this->configResolver->expects($this->any())->method('getParameter')->will($this->returnValueMap(array(array('module_default_layout', 'ezpublish_legacy', null, $customLayout), array('legacy_mode', null, null, false))));
$this->templateEngine->expects($this->once())->method('render')->with($customLayout, array('module_result' => $moduleResult))->will($this->returnValue($contentWithLayout));
$manager = new LegacyResponseManager($this->templateEngine, $this->configResolver);
$kernelResult = new ezpKernelResult($content, array('module_result' => $moduleResult));
$response = $manager->generateResponseFromModuleResult($kernelResult);
$this->assertInstanceOf('eZ\\Bundle\\EzPublishLegacyBundle\\LegacyResponse', $response);
$this->assertSame($contentWithLayout, $response->getContent());
$this->assertSame($moduleResult['errorCode'], $response->getStatusCode());
$this->assertSame($moduleResult, $response->getModuleResult());
}
示例6: testMatchRequestLegacyModeAuthorizedRoute
public function testMatchRequestLegacyModeAuthorizedRoute()
{
$pathinfo = '/siteaccess/foo/bar';
$semanticPathinfo = '/foo/bar';
$request = Request::create($pathinfo);
$request->attributes->set('semanticPathinfo', $semanticPathinfo);
/** @var \PHPUnit_Framework_MockObject_MockObject|DefaultRouter $router */
$router = $this->generateRouter(array('match'));
$router->setLegacyAwareRoutes(array('my_legacy_aware_route'));
$matchedParameters = array('_route' => 'my_legacy_aware_route');
$router->expects($this->once())->method('match')->with($semanticPathinfo)->will($this->returnValue($matchedParameters));
$this->configResolver->expects($this->never())->method('getParameter');
$this->assertSame($matchedParameters, $router->matchRequest($request));
}
示例7: testRenderLocation
public function testRenderLocation()
{
$content = new Content(['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo()])]);
$location = new Location(['contentInfo' => new ContentInfo()]);
// Configuring view provider behaviour
$templateIdentifier = 'foo:bar:baz';
$params = array('foo' => 'bar');
$this->viewConfigurator->expects($this->once())->method('configure')->will($this->returnCallback(function (View $view) use($templateIdentifier) {
$view->setTemplateIdentifier($templateIdentifier);
}));
$languages = array('eng-GB');
$this->configResolverMock->expects($this->any())->method('getParameter')->with('languages')->will($this->returnValue($languages));
$contentService = $this->getMock('eZ\\Publish\\API\\Repository\\ContentService');
$contentService->expects($this->any())->method('loadContentByContentInfo')->with($location->contentInfo, $languages)->will($this->returnValue($content));
$this->repositoryMock->expects($this->any())->method('getContentService')->will($this->returnValue($contentService));
// Configuring template engine behaviour
$expectedTemplateResult = 'This is location rendering';
$this->templateEngineMock->expects($this->once())->method('render')->with($templateIdentifier, $params + array('location' => $location, 'content' => $content, 'viewbaseLayout' => $this->viewBaseLayout))->will($this->returnValue($expectedTemplateResult));
self::assertSame($expectedTemplateResult, $this->viewManager->renderLocation($location, 'customViewType', $params));
}
示例8: testGetAvailableLanguagesWithoutTranslationSiteAccesses
public function testGetAvailableLanguagesWithoutTranslationSiteAccesses()
{
$this->configResolver->expects($this->any())->method('getParameter')->will($this->returnValueMap(array(array('translation_siteaccesses', null, null, array()), array('related_siteaccesses', null, null, array('fre', 'esl', 'heb')), array('languages', null, null, array('eng-GB')), array('languages', null, 'fre', array('fre-FR', 'eng-GB')), array('languages', null, 'esl', array('esl-ES', 'fre-FR', 'eng-GB')), array('languages', null, 'heb', array('heb-IL', 'eng-GB')))));
$expectedLanguages = array('eng-GB', 'esl-ES', 'fre-FR', 'heb-IL');
$this->assertSame($expectedLanguages, $this->translationHelper->getAvailableLanguages());
}