本文整理汇总了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()));
}
示例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));
}
示例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));
}