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


PHP SiteRepository::expects方法代码示例

本文整理汇总了PHP中TYPO3\Neos\Domain\Repository\SiteRepository::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteRepository::expects方法的具体用法?PHP SiteRepository::expects怎么用?PHP SiteRepository::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\Neos\Domain\Repository\SiteRepository的用法示例。


在下文中一共展示了SiteRepository::expects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Setup the most commonly used mocks and a real FrontendRoutePartHandler. The mock objects created by this function
  * will not be sufficient for most tests, but they are the lowest common denominator.
  *
  * @return void
  */
 protected function setUp()
 {
     $this->routePartHandler = new FrontendNodeRoutePartHandler();
     $this->routePartHandler->setName('node');
     // The mockContextFactory is configured to return the last mock context which has been built with buildMockContext():
     $mockContextFactory = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Service\\ContextFactory', array('create'));
     $mockContextFactory->mockContext = null;
     $mockContextFactory->expects($this->any())->method('create')->will($this->returnCallback(function ($contextProperties) use($mockContextFactory) {
         if (isset($contextProperties['currentSite'])) {
             $mockContextFactory->mockContext->mockSite = $contextProperties['currentSite'];
         }
         if (isset($contextProperties['currentDomain'])) {
             $mockContextFactory->mockContext->mockDomain = $contextProperties['currentDomain'];
         }
         if (isset($contextProperties['dimensions'])) {
             $mockContextFactory->mockContext->mockDimensions = $contextProperties['dimensions'];
         }
         if (isset($contextProperties['targetDimensions'])) {
             $mockContextFactory->mockContext->mockTargetDimensions = $contextProperties['targetDimensions'];
         }
         return $mockContextFactory->mockContext;
     }));
     $this->mockContextFactory = $mockContextFactory;
     $this->inject($this->routePartHandler, 'contextFactory', $this->mockContextFactory);
     $this->mockSystemLogger = $this->getMock('TYPO3\\Flow\\Log\\SystemLoggerInterface');
     $this->inject($this->routePartHandler, 'systemLogger', $this->mockSystemLogger);
     $this->mockDomainRepository = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Repository\\DomainRepository')->disableOriginalConstructor()->getMock();
     $this->inject($this->routePartHandler, 'domainRepository', $this->mockDomainRepository);
     $this->mockSiteRepository = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Repository\\SiteRepository')->disableOriginalConstructor()->getMock();
     $this->mockSiteRepository->expects($this->any())->method('findFirstOnline')->will($this->returnValue(null));
     $this->inject($this->routePartHandler, 'siteRepository', $this->mockSiteRepository);
     $this->contentDimensionPresetSource = new ConfigurationContentDimensionPresetSource();
     $this->contentDimensionPresetSource->setConfiguration(array());
     $this->inject($this->routePartHandler, 'contentDimensionPresetSource', $this->contentDimensionPresetSource);
 }
开发者ID:reinis-zumbergs,项目名称:neos-development-collection,代码行数:41,代码来源:FrontendNodeRoutePartHandlerTest.php

示例2: setUp

 public function setUp()
 {
     $this->publishingService = new PublishingService();
     $this->mockWorkspaceRepository = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Repository\\WorkspaceRepository')->disableOriginalConstructor()->setMethods(array('findOneByName'))->getMock();
     $this->inject($this->publishingService, 'workspaceRepository', $this->mockWorkspaceRepository);
     $this->mockNodeDataRepository = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Repository\\NodeDataRepository')->disableOriginalConstructor()->setMethods(array('findByWorkspace'))->getMock();
     $this->inject($this->publishingService, 'nodeDataRepository', $this->mockNodeDataRepository);
     $this->mockNodeFactory = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Factory\\NodeFactory')->disableOriginalConstructor()->getMock();
     $this->inject($this->publishingService, 'nodeFactory', $this->mockNodeFactory);
     $this->mockContextFactory = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\ContextFactoryInterface')->disableOriginalConstructor()->getMock();
     $this->inject($this->publishingService, 'contextFactory', $this->mockContextFactory);
     $this->mockDomainRepository = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Repository\\DomainRepository')->disableOriginalConstructor()->getMock();
     $this->inject($this->publishingService, 'domainRepository', $this->mockDomainRepository);
     $this->mockSiteRepository = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Repository\\SiteRepository')->disableOriginalConstructor()->getMock();
     $this->mockSite = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Model\\Site')->disableOriginalConstructor()->getMock();
     $this->mockSiteRepository->expects($this->any())->method('findFirstOnline')->will($this->returnValue($this->mockSite));
     $this->inject($this->publishingService, 'siteRepository', $this->mockSiteRepository);
     $this->mockBaseWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
     $this->mockBaseWorkspace->expects($this->any())->method('getName')->will($this->returnValue('live'));
     $this->mockBaseWorkspace->expects($this->any())->method('getBaseWorkspace')->will($this->returnValue(null));
     $this->mockWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
     $this->mockWorkspace->expects($this->any())->method('getName')->will($this->returnValue('workspace-name'));
     $this->mockWorkspace->expects($this->any())->method('getBaseWorkspace')->will($this->returnValue($this->mockBaseWorkspace));
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:24,代码来源:PublishingServiceTest.php


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