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