Пример #1
0
 /**
  * @test
  */
 public function setWorkspacesAllowsForSettingTheWorkspaceForInternalPurposes()
 {
     $newWorkspace = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace', array(), array(), '', FALSE);
     $this->assertSame($this->mockWorkspace, $this->nodeData->getWorkspace());
     $this->nodeData->setWorkspace($newWorkspace);
     $this->assertSame($newWorkspace, $this->nodeData->getWorkspace());
 }
Пример #2
0
 /**
  * The NodeData matches the context if the workspace matches exactly.
  * Needs to be adjusted for further context dimensions.
  *
  * @return boolean
  */
 protected function isNodeDataMatchingContext()
 {
     if ($this->nodeDataIsMatchingContext === NULL) {
         $workspacesMatch = $this->nodeData->getWorkspace() !== NULL && $this->context->getWorkspace() !== NULL && $this->nodeData->getWorkspace()->getName() === $this->context->getWorkspace()->getName();
         $this->nodeDataIsMatchingContext = $workspacesMatch && $this->dimensionsAreMatchingTargetDimensionValues();
     }
     return $this->nodeDataIsMatchingContext;
 }
 /**
  * @test
  */
 public function setWorkspacesAllowsForSettingTheWorkspaceForInternalPurposes()
 {
     /** @var Workspace|\PHPUnit_Framework_MockObject_MockObject $newWorkspace */
     $newWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
     $this->assertSame($this->mockWorkspace, $this->nodeData->getWorkspace());
     $this->nodeData->setWorkspace($newWorkspace);
     $this->assertSame($newWorkspace, $this->nodeData->getWorkspace());
 }
 /**
  * @test
  */
 public function setWorkspacesAllowsForSettingTheWorkspaceForInternalPurposes()
 {
     /** @var Workspace|\PHPUnit_Framework_MockObject_MockObject $newWorkspace */
     $newWorkspace = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace', array(), array(), '', false);
     $this->assertSame($this->mockWorkspace, $this->nodeData->getWorkspace());
     $this->nodeData->setWorkspace($newWorkspace);
     $this->assertSame($newWorkspace, $this->nodeData->getWorkspace());
 }
 /**
  * Generates a Context that exactly fits the given NodeData Workspace, Dimensions & Site.
  *
  * @param NodeData $nodeData
  * @return ContentContext
  */
 protected function createContextMatchingNodeData(NodeData $nodeData)
 {
     $nodePath = NodePaths::getRelativePathBetween(SiteService::SITES_ROOT_PATH, $nodeData->getPath());
     list($siteNodeName) = explode('/', $nodePath);
     $site = $this->siteRepository->findOneByNodeName($siteNodeName);
     $contextProperties = ['workspaceName' => $nodeData->getWorkspace()->getName(), 'invisibleContentShown' => true, 'inaccessibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $nodeData->getDimensionValues(), 'currentSite' => $site];
     if ($domain = $site->getFirstActiveDomain()) {
         $contextProperties['currentDomain'] = $domain;
     }
     return $this->_contextFactory->create($contextProperties);
 }
 /**
  * Change the property on the given node.
  *
  * @param NodeData $node
  * @return NodeData
  */
 public function execute(NodeData $node)
 {
     $reference = (string) $node->getProperty('plugin');
     $workspace = $node->getWorkspace();
     do {
         if ($this->reverse === false && preg_match(NodeInterface::MATCH_PATTERN_PATH, $reference)) {
             $pluginNode = $this->nodeDataRepository->findOneByPath($reference, $node->getWorkspace());
         } else {
             $pluginNode = $this->nodeDataRepository->findOneByIdentifier($reference, $node->getWorkspace());
         }
         if (isset($pluginNode)) {
             break;
         }
         $workspace = $workspace->getBaseWorkspace();
     } while ($workspace && $workspace->getName() !== 'live');
     if (isset($pluginNode)) {
         $node->setProperty('plugin', $this->reverse === false ? $pluginNode->getIdentifier() : $pluginNode->getPath());
     }
     return $node;
 }
 /**
  * Returns TRUE if the given node is in the workspace this filter expects.
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeData $node
  * @return boolean
  */
 public function matches(\TYPO3\TYPO3CR\Domain\Model\NodeData $node)
 {
     return $node->getWorkspace() !== NULL && $node->getWorkspace()->getName() === $this->workspaceName;
 }
 /**
  * Returns TRUE if the given node is in the workspace this filter expects.
  *
  * @param NodeData $node
  * @return boolean
  */
 public function matches(NodeData $node)
 {
     return $node->getWorkspace() !== null && $node->getWorkspace()->getName() === $this->workspaceName;
 }
 /**
  * Generates a Context that exactly fits the given NodeData Workspace and Dimensions.
  *
  * TODO: We could get more specific about removed and invisible content by adding some more logic here that generates fitting values.
  *
  * @param NodeData $nodeData
  * @return Context
  */
 public function createContextMatchingNodeData(NodeData $nodeData)
 {
     return $this->contextFactory->create(array('workspaceName' => $nodeData->getWorkspace()->getName(), 'invisibleContentShown' => true, 'inaccessibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $nodeData->getDimensionValues()));
 }