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