當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NodeInterface::expects方法代碼示例

本文整理匯總了PHP中PHPCR\NodeInterface::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeInterface::expects方法的具體用法?PHP NodeInterface::expects怎麽用?PHP NodeInterface::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PHPCR\NodeInterface的用法示例。


在下文中一共展示了NodeInterface::expects方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testWriteMetadata

 public function testWriteMetadata()
 {
     $parentClasses = array(self::CLASS_TEST_2, self::CLASS_TEST_3);
     $this->node->expects($this->at(0))->method('setProperty')->with('phpcr:class', self::CLASS_TEST_1, PropertyType::STRING);
     $this->dm->expects($this->once())->method('getClassMetadata')->with(self::CLASS_TEST_1)->will($this->returnValue($this->metadata));
     $this->metadata->expects($this->once())->method('getParentClasses')->will($this->returnValue($parentClasses));
     // Assert that we set the correct parent classes
     $this->node->expects($this->at(1))->method('setProperty')->with('phpcr:classparents', $parentClasses, PropertyType::STRING);
     $this->mapper->writeMetadata($this->dm, $this->node, self::CLASS_TEST_1);
 }
開發者ID:steffenbrem,項目名稱:phpcr-odm,代碼行數:10,代碼來源:DocumentClassMapperTest.php

示例2: testRootEdgeCase

 public function testRootEdgeCase()
 {
     $this->buildMocks('/');
     $this->managerRegistry->expects($this->any())->method('getManagerForClass')->with(get_class($this->object))->will($this->returnValue($this->documentManager));
     $this->documentManager->expects($this->any())->method('getNodeForDocument')->with($this->object)->willReturn($this->node);
     $this->node->expects($this->any())->method('getDepth')->will($this->returnValue(4));
     $urlInformation = new UrlInformation();
     $this->guesser->guessValues($urlInformation, $this->object, 'default');
     $this->assertEquals(3, $urlInformation->getDepth());
 }
開發者ID:symfony-cmf,項目名稱:seo-bundle,代碼行數:10,代碼來源:DepthGuesserTest.php

示例3: testWriteMultipleDifferentTypes

 public function testWriteMultipleDifferentTypes()
 {
     $this->prepareMultipleBlockProperty();
     $this->node = $this->getMock('\\Jackalope\\Node', ['setProperty'], [], '', false);
     $result = [];
     $this->node->expects($this->any())->method('setProperty')->will($this->returnCallback(function () use(&$result) {
         $args = func_get_args();
         $result[$args[0]] = $args[1];
     }));
     $data = [['type' => 'type1', 'title' => 'Test-Title-1', 'article' => ['Test-Article-1-1', 'Test-Article-1-2'], 'sub-block' => [['type' => 'subType1', 'title' => 'Test-Title-Sub-1', 'article' => 'Test-Article-Sub-1']]], ['type' => 'type2', 'name' => 'Test-Name-2']];
     $this->blockProperty->setValue($data);
     $this->blockContentType->write($this->node, new TranslatedProperty($this->blockProperty, 'de', 'i18n'), 1, 'default', 'de', '');
     // check repository node
     $this->assertEquals(['i18n:de-block1-length' => 2, 'i18n:de-block1-type#0' => $data[0]['type'], 'i18n:de-block1-title#0' => $data[0]['title'], 'i18n:de-block1-article#0' => $data[0]['article'], 'i18n:de-block1-sub-block#0-length' => 1, 'i18n:de-block1-sub-block#0-type#0' => $data[0]['sub-block'][0]['type'], 'i18n:de-block1-sub-block#0-title#0' => $data[0]['sub-block'][0]['title'], 'i18n:de-block1-sub-block#0-article#0' => $data[0]['sub-block'][0]['article'], 'i18n:de-block1-type#1' => $data[1]['type'], 'i18n:de-block1-name#1' => $data[1]['name']], $result);
     // check resulted structure
     $this->assertEquals($data, $this->blockProperty->getValue());
 }
開發者ID:Silwereth,項目名稱:sulu,代碼行數:17,代碼來源:BlockContentTypeTest.php


注:本文中的PHPCR\NodeInterface::expects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。