public findByWebspaceRoot ( $locale, $webspaceKey, Sulu\Component\Content\Repository\Mapping\MappingInterface $mapping, Sulu\Component\Security\Authentication\UserInterface $user = null ) | ||
$mapping | Sulu\Component\Content\Repository\Mapping\MappingInterface | |
$user | Sulu\Component\Security\Authentication\UserInterface |
public function testFindByWebspaceRootPublished() { $this->initPhpcr(); $page1 = $this->createPage('test-1', 'de'); $page2 = $this->createPage('test-2', 'de'); $page2->setWorkflowStage(WorkflowStage::TEST); $this->documentManager->persist($page2, 'de', ['path' => $this->sessionManager->getContentPath('sulu_io') . '/test-2', 'auto_create' => true]); $this->documentManager->flush(); $result = $this->contentRepository->findByWebspaceRoot('de', 'sulu_io', MappingBuilder::create()->setOnlyPublished(true)->getMapping()); $this->assertCount(1, $result); $this->assertEquals('/test-1', $result[0]->getPath()); }
public function testFindByWebspaceRootOneLayer() { $this->initPhpcr(); $page1 = $this->createPage('test-1', 'de'); $this->createPage('test-1-1', 'de', [], $page1); $this->createPage('test-1-2', 'de', [], $page1); $page2 = $this->createPage('test-2', 'de'); $this->createPage('test-2-1', 'de', [], $page2); $this->createPage('test-2-2', 'de', [], $page2); $this->createPage('test-3', 'de'); $result = $this->contentRepository->findByWebspaceRoot('de', 'sulu_io', MappingBuilder::create()->getMapping()); $this->assertCount(3, $result); $this->assertNotNull($result[0]->getId()); $this->assertEquals('/test-1', $result[0]->getPath()); $this->assertNotNull($result[1]->getId()); $this->assertEquals('/test-2', $result[1]->getPath()); $this->assertNotNull($result[2]->getId()); $this->assertEquals('/test-3', $result[2]->getPath()); }