/**
  * @test
  */
 public function sortNodesWithMovedToRelations()
 {
     $nodeEnterprise = $this->buildNodeMock('/sites/typo3cr/enterprise');
     // "company" was moved to "enterprise"
     $nodeCompany = $this->buildNodeMock('/sites/typo3cr/company', $nodeEnterprise->getNodeData());
     $nodeAboutUs = $this->buildNodeMock('/sites/typo3cr/company/about-us');
     // "service" was moved to "company"
     $nodeService = $this->buildNodeMock('/sites/typo3cr/service', $nodeCompany->getNodeData());
     $unpublishedNodes = array($nodeAboutUs, $nodeService, $nodeCompany, $nodeEnterprise);
     $solver = new NodePublishingDependencySolver();
     $sortedNodes = $solver->sort($unpublishedNodes);
     $this->assertBeforeInArray($nodeEnterprise, $nodeCompany, $sortedNodes);
     $this->assertBeforeInArray($nodeCompany, $nodeAboutUs, $sortedNodes);
     $this->assertBeforeInArray($nodeCompany, $nodeService, $sortedNodes);
 }
 /**
  * Sort an unsorted list of nodes in a publishable order
  *
  * @param array $nodes Unsorted list of nodes (unpublished nodes)
  * @return array Sorted list of nodes for publishing
  * @throws WorkspaceException
  */
 protected function sortNodesForPublishing(array $nodes)
 {
     $sorter = new NodePublishingDependencySolver();
     return $sorter->sort($nodes);
 }