當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。