本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeDataRepository::expects方法的具体用法?PHP NodeDataRepository::expects怎么用?PHP NodeDataRepository::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository
的用法示例。
在下文中一共展示了NodeDataRepository::expects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findByParentAndNodeTypeRemovesRemovedNodeInRepositoryAndRespectsWorkspaceAndDimensions
/**
* @test
*/
public function findByParentAndNodeTypeRemovesRemovedNodeInRepositoryAndRespectsWorkspaceAndDimensions()
{
$liveWorkspace = new Workspace('live');
$nodeData = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData')->disableOriginalConstructor()->getMock();
$nodeData->expects($this->any())->method('getIdentifier')->will($this->returnValue('abcd-efgh-ijkl-mnop'));
$nodeData->expects($this->any())->method('getPath')->will($this->returnValue('/foo/bar'));
$nodeData->expects($this->any())->method('getDepth')->will($this->returnValue(2));
$this->nodeDataRepository->remove($nodeData);
$dimensions = array('persona' => array('everybody'), 'language' => array('de_DE', 'mul_ZZ'));
$nodeData->expects($this->atLeastOnce())->method('matchesWorkspaceAndDimensions')->with($liveWorkspace, $dimensions)->will($this->returnValue(TRUE));
$this->nodeDataRepository->expects($this->any())->method('getNodeDataForParentAndNodeType')->will($this->returnValue(array('abcd-efgh-ijkl-mnop' => $nodeData)));
$result = $this->nodeDataRepository->findByParentAndNodeType('/foo', NULL, $liveWorkspace, $dimensions);
$this->assertCount(0, $result);
}
示例2: getUnpublishedNodesDoesNotReturnInvalidNodes
/**
* @test
*/
public function getUnpublishedNodesDoesNotReturnInvalidNodes()
{
$mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock();
$expectedContextProperties = array('workspaceName' => $this->mockWorkspace->getName(), 'inaccessibleContentShown' => true, 'invisibleContentShown' => true, 'removedContentShown' => true, 'currentSite' => $this->mockSite, 'dimensions' => array());
$this->mockContextFactory->expects($this->any())->method('create')->with($expectedContextProperties)->will($this->returnValue($mockContext));
$mockNodeData1 = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData')->disableOriginalConstructor()->getMock();
$mockNodeData2 = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData')->disableOriginalConstructor()->getMock();
$mockNodeData1->expects($this->any())->method('getDimensionValues')->will($this->returnValue(array()));
$mockNodeData2->expects($this->any())->method('getDimensionValues')->will($this->returnValue(array()));
$mockNode1 = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->getMock();
$mockNode1->expects($this->any())->method('getNodeData')->will($this->returnValue($mockNodeData1));
$mockNode1->expects($this->any())->method('getPath')->will($this->returnValue('/node1'));
$this->mockNodeFactory->expects($this->at(0))->method('createFromNodeData')->with($mockNodeData1, $mockContext)->will($this->returnValue($mockNode1));
$this->mockNodeFactory->expects($this->at(1))->method('createFromNodeData')->with($mockNodeData2, $mockContext)->will($this->returnValue(null));
$this->mockNodeDataRepository->expects($this->atLeastOnce())->method('findByWorkspace')->with($this->mockWorkspace)->will($this->returnValue(array($mockNodeData1, $mockNodeData2)));
$actualResult = $this->publishingService->getUnpublishedNodes($this->mockWorkspace);
$this->assertSame($actualResult, array($mockNode1));
}