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


PHP ContentService::expects方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->matcherFactoryMock = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\Matcher\\MatcherFactoryInterface');
     $this->configResolverMock = $this->getMock('eZ\\Publish\\Core\\MVC\\ConfigResolverInterface');
     $this->contentServiceMock = $this->getMock('eZ\\Publish\\API\\Repository\\ContentService');
     $this->contentServiceMock->expects($this->any())->method('loadContentByContentInfo')->will($this->returnValue(new Content()));
 }
开发者ID:michalpipa,项目名称:CommentsBundle,代码行数:8,代码来源:CommentsRendererTest.php

示例2: testGetTranslatedNameByContentInfoForcedLanguageMainLanguage

 public function testGetTranslatedNameByContentInfoForcedLanguageMainLanguage()
 {
     $name = 'Name in main language';
     $mainLanguage = 'eng-GB';
     $contentInfo = new ContentInfo(array('id' => 123, 'mainLanguageCode' => $mainLanguage, 'name' => $name));
     $this->configResolver->expects($this->never())->method('getParameter');
     $this->contentService->expects($this->never())->method('loadContentByContentInfo');
     $this->assertSame($name, $this->translationHelper->getTranslatedContentNameByContentInfo($contentInfo, $mainLanguage));
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:9,代码来源:TranslationHelperTest.php

示例3: testLoadBlock

 public function testLoadBlock()
 {
     $contentId = 12;
     $blockId = 'abc0123';
     $block = new Block(array('id' => $blockId));
     $zone = new Zone(array('blocks' => array($block)));
     $page = new Page(array('zones' => array($zone)));
     $value = new Value($page);
     $field = new Field(array('value' => $value));
     $content = new Content(array('internalFields' => array($field)));
     $this->pageService->setStorageGateway($this->storageGateway);
     $this->storageGateway->expects($this->once())->method('getContentIdByBlockId')->with($blockId)->will($this->returnValue($contentId));
     $this->contentService->expects($this->once())->method('loadContent')->with($contentId)->will($this->returnValue($content));
     // Calling assertion twice to test cache (comes along with storage gateway's
     // getLocationIdByBlockId() that should be called only once. See above)
     $this->assertSame($block, $this->pageService->loadBlock($blockId));
     $this->assertSame($block, $this->pageService->loadBlock($blockId));
 }
开发者ID:ezsystems,项目名称:ezplatform-page-fieldtype,代码行数:18,代码来源:PageServiceTest.php


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