本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Service\ContextFactoryInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ContextFactoryInterface::expects方法的具体用法?PHP ContextFactoryInterface::expects怎么用?PHP ContextFactoryInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Service\ContextFactoryInterface
的用法示例。
在下文中一共展示了ContextFactoryInterface::expects方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evaluateSkipsNodesNotAvailableInModifiedContext
/**
* @test
*/
public function evaluateSkipsNodesNotAvailableInModifiedContext()
{
$suppliedContextProperties = array('infiniteImprobabilityDrive' => true);
$nodeContextProperties = array('infiniteImprobabilityDrive' => false, 'autoRemoveUnsuitableContent' => true);
$nodeIdentifier = 'c575c430-c971-11e3-a6e7-14109fd7a2dd';
$mockNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface');
$mockNode->expects($this->any())->method('getIdentifier')->will($this->returnValue($nodeIdentifier));
$mockFlowQuery = $this->buildFlowQueryWithNodeInContext($mockNode, $nodeContextProperties);
$modifiedNodeContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock();
$this->mockContextFactory->expects($this->any())->method('create')->will($this->returnValue($modifiedNodeContext));
$modifiedNodeContext->expects($this->once())->method('getNodeByIdentifier')->with($nodeIdentifier)->will($this->returnValue(null));
$mockFlowQuery->expects($this->atLeastOnce())->method('setContext')->with(array());
$this->operation->evaluate($mockFlowQuery, array($suppliedContextProperties));
}
示例2: convertFromSetsRemovedContentShownContextPropertyFromConfigurationForContextPathSource
/**
* @test
*/
public function convertFromSetsRemovedContentShownContextPropertyFromConfigurationForContextPathSource()
{
$contextPath = '/foo/bar@user-demo';
$mockLiveWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
$mockNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface');
$mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock();
$mockContext->expects($this->any())->method('getWorkspace')->will($this->returnValue($mockLiveWorkspace));
$mockContext->expects($this->any())->method('getNodeByIdentifier')->with($contextPath)->will($this->returnValue($mockNode));
$this->mockConverterConfiguration->expects($this->any())->method('getConfigurationValue')->with('TYPO3\\TYPO3CR\\TypeConverter\\NodeConverter', NodeConverter::REMOVED_CONTENT_SHOWN)->will($this->returnValue(TRUE));
$this->mockContextFactory->expects($this->any())->method('create')->with($this->callback(function ($properties) {
Assert::assertTrue(isset($properties['removedContentShown']), 'removedContentShown context property should be set');
Assert::assertTrue($properties['removedContentShown'], 'removedContentShown context property should be TRUE');
return TRUE;
}))->will($this->returnValue($mockContext));
$this->nodeConverter->convertFrom($contextPath, NULL, array(), $this->mockConverterConfiguration);
}
示例3: setUpNodeWithNodeType
/**
* @param string $nodePath
* @param array $nodeTypeProperties
* @return NodeInterface
*/
protected function setUpNodeWithNodeType($nodePath, $nodeTypeProperties = array())
{
$mockLiveWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
$mockNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface');
$mockNodeType = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeType')->disableOriginalConstructor()->getMock();
$mockNodeType->expects($this->any())->method('getProperties')->will($this->returnValue($nodeTypeProperties));
$mockNode->expects($this->any())->method('getNodeType')->will($this->returnValue($mockNodeType));
$mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock();
$mockContext->expects($this->any())->method('getWorkspace')->will($this->returnValue($mockLiveWorkspace));
$mockContext->expects($this->any())->method('getNode')->with($nodePath)->will($this->returnValue($mockNode));
$mockNode->expects($this->any())->method('getContext')->will($this->returnValue($mockContext));
// Simulate context properties by returning the same properties that were given to the ContextFactory
$this->mockContextFactory->expects($this->any())->method('create')->will($this->returnCallback(function ($contextProperties) use($mockContext) {
$mockContext->expects($this->any())->method('getProperties')->will($this->returnValue($contextProperties));
return $mockContext;
}));
return $mockNode;
}
示例4: 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));
}
示例5: resolveCreatesContextForTheWorkspaceMentionedInTheContextString
/**
* @test
*/
public function resolveCreatesContextForTheWorkspaceMentionedInTheContextString()
{
$mockContext = $this->buildMockContext(array('workspaceName' => 'user-johndoe'));
$mockContext->mockSite = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock();
$mockContext->mockSiteNode = $this->buildSiteNode($mockContext, '/sites/examplecom');
$mockSubNode = $this->buildSubNode($mockContext->mockSiteNode, 'home');
$mockSubNode->mockProperties['uriPathSegment'] = 'home';
// resolveValue() will use $contentContext to retrieve the resolved node:
$mockContext->expects($this->any())->method('getNode')->will($this->returnCallback(function ($nodePath) use($mockSubNode) {
return $nodePath === '/sites/examplecom/home' ? $mockSubNode : null;
}));
$that = $this;
$this->mockContextFactory->expects($this->once())->method('create')->will($this->returnCallback(function ($contextProperties) use($that, $mockContext) {
// The important assertion:
$that->assertSame('user-johndoe', $contextProperties['workspaceName']);
return $mockContext;
}));
$routeValues = array('node' => '/sites/examplecom/home@user-johndoe');
$this->assertTrue($this->routePartHandler->resolve($routeValues));
}
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:23,代码来源:FrontendNodeRoutePartHandlerTest.php
示例6: resolveCreatesContextForCurrentDomainIfGivenValueIsAStringAndADomainIsFound
/**
* @test
*/
public function resolveCreatesContextForCurrentDomainIfGivenValueIsAStringAndADomainIsFound()
{
$mockContext = $this->buildMockContext(array('workspaceName' => 'user-johndoe'));
$mockContext->mockSite = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\Site', array(), array(), '', false);
$mockSiteNode = $this->buildSiteNode($mockContext, '/sites/examplecom');
$mockContext->mockSiteNode = $mockSiteNode;
$mockContext->expects($this->any())->method('getNode')->will($this->returnCallback(function ($nodePath) use($mockSiteNode) {
return $nodePath === '/sites/examplecom' ? $mockSiteNode : null;
}));
$mockDomain = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Model\\Domain')->disableOriginalConstructor()->getMock();
$this->mockDomainRepository->expects($this->atLeastOnce())->method('findOneByActiveRequest')->will($this->returnValue($mockDomain));
$that = $this;
$this->mockContextFactory->expects($this->once())->method('create')->will($this->returnCallback(function ($contextProperties) use($that, $mockContext, $mockDomain) {
// The important assertion:
$that->assertSame($mockDomain, $contextProperties['currentDomain']);
return $mockContext;
}));
$routeValues = array('node' => '/sites/examplecom');
$this->assertTrue($this->routePartHandler->resolve($routeValues));
}
开发者ID:reinis-zumbergs,项目名称:neos-development-collection,代码行数:23,代码来源:FrontendNodeRoutePartHandlerTest.php