当前位置: 首页>>代码示例>>PHP>>正文


PHP ConfigResolverInterface::expects方法代码示例

本文整理汇总了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);
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:7,代码来源:StreamFileListenerTest.php

示例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));
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:11,代码来源:DefaultRouterTest.php

示例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'));
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:15,代码来源:LocaleListenerTest.php

示例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());
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:11,代码来源:SecurityTest.php

示例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());
 }
开发者ID:masev,项目名称:ezpublish-kernel,代码行数:17,代码来源:LegacyResponseManagerTest.php

示例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));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:14,代码来源:DefaultRouterTest.php

示例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));
 }
开发者ID:emodric,项目名称:ezpublish-kernel,代码行数:20,代码来源:ViewManagerTest.php

示例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());
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:6,代码来源:TranslationHelperTest.php


注:本文中的eZ\Publish\Core\MVC\ConfigResolverInterface::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。