createContextMatchingNodeData() публичный Метод

TODO: We could get more specific about removed and invisible content by adding some more logic here that generates fitting values.
public createContextMatchingNodeData ( NodeData $nodeData ) : Context
$nodeData Neos\ContentRepository\Domain\Model\NodeData
Результат Neos\ContentRepository\Domain\Service\Context
 /**
  * @test
  */
 public function createContextMatchingNodeDataCreatesMatchingContext()
 {
     $dimensionValues = array('language' => array('is'));
     $workspaceName = 'some-workspace';
     $mockContext = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
     $mockWorkspace = $this->getMockBuilder(Workspace::class)->setMockClassName('MockWorkspace')->disableOriginalConstructor()->getMock();
     $mockWorkspace->expects(self::any())->method('getName')->will(self::returnValue($workspaceName));
     $mockContextFactory = $this->createMock(ContextFactoryInterface::class);
     $mockContextFactory->expects(self::once())->method('create')->with(array('workspaceName' => $workspaceName, 'invisibleContentShown' => true, 'inaccessibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $dimensionValues))->willReturn($mockContext);
     $this->inject($this->nodeFactory, 'contextFactory', $mockContextFactory);
     $mockNodeData = $this->getMockBuilder(NodeData::class)->disableOriginalConstructor()->getMock();
     $mockNodeData->expects(self::any())->method('getWorkspace')->will($this->returnValue($mockWorkspace));
     $mockNodeData->expects(self::any())->method('getDimensionValues')->willReturn($dimensionValues);
     $context = $this->nodeFactory->createContextMatchingNodeData($mockNodeData);
     self::assertEquals($mockContext, $context);
 }
 /**
  * Reorder child nodes for the given node type
  *
  * @param string $workspaceName
  * @param boolean $dryRun
  * @param NodeType $nodeType
  * @return void
  */
 protected function reorderChildNodesByNodeType($workspaceName, $dryRun, NodeType $nodeType)
 {
     $nodeTypes = $this->nodeTypeManager->getSubNodeTypes($nodeType->getName(), false);
     $nodeTypes[$nodeType->getName()] = $nodeType;
     if ($this->nodeTypeManager->hasNodeType((string) $nodeType)) {
         $nodeType = $this->nodeTypeManager->getNodeType((string) $nodeType);
         $nodeTypeNames[$nodeType->getName()] = $nodeType;
     } else {
         $this->output->outputLine('Node type "%s" does not exist', array((string) $nodeType));
         exit(1);
     }
     /** @var $nodeType NodeType */
     foreach ($nodeTypes as $nodeTypeName => $nodeType) {
         $childNodes = $nodeType->getAutoCreatedChildNodes();
         if ($childNodes === array()) {
             continue;
         }
         foreach ($this->getNodeDataByNodeTypeAndWorkspace($nodeTypeName, $workspaceName) as $nodeData) {
             /** @var NodeInterface $childNodeBefore */
             $childNodeBefore = null;
             $context = $this->nodeFactory->createContextMatchingNodeData($nodeData);
             $node = $this->nodeFactory->createFromNodeData($nodeData, $context);
             if (!$node instanceof NodeInterface) {
                 continue;
             }
             foreach ($childNodes as $childNodeName => $childNodeType) {
                 $childNode = $node->getNode($childNodeName);
                 if ($childNode) {
                     if ($childNodeBefore) {
                         if ($dryRun === false) {
                             if ($childNodeBefore->getIndex() >= $childNode->getIndex()) {
                                 $childNode->moveAfter($childNodeBefore);
                                 $this->output->outputLine('Moved node named "%s" after node named "%s" in "%s"', array($childNodeName, $childNodeBefore->getName(), $node->getPath()));
                             }
                         } else {
                             $this->output->outputLine('Should move node named "%s" after node named "%s" in "%s"', array($childNodeName, $childNodeBefore->getName(), $node->getPath()));
                         }
                     }
                 } else {
                     $this->output->outputLine('Missing child node named "%s" in "%s".', array($childNodeName, $node->getPath()));
                 }
                 $childNodeBefore = $childNode;
             }
         }
     }
 }