findByPaths() public method

public findByPaths ( array $paths, $locale, Sulu\Component\Content\Repository\Mapping\MappingInterface $mapping, Sulu\Component\Security\Authentication\UserInterface $user = null )
$paths array
$mapping Sulu\Component\Content\Repository\Mapping\MappingInterface
$user Sulu\Component\Security\Authentication\UserInterface
Exemplo n.º 1
0
 public function testFindByPaths()
 {
     $this->initPhpcr();
     $page1 = $this->createPage('test-1', 'de');
     $page11 = $this->createPage('test-1/test-1', 'de', [], $page1);
     $page2 = $this->createPage('test-2', 'de');
     $page3 = $this->createPage('test-3', 'de');
     $result = $this->contentRepository->findByPaths(['/cmf/sulu_io/contents', '/cmf/sulu_io/contents/test-1', '/cmf/sulu_io/contents/test-2'], 'de', MappingBuilder::create()->addProperties(['title'])->getMapping());
     $this->assertCount(3, $result);
     $this->assertEquals($this->sessionManager->getContentNode('sulu_io')->getIdentifier(), $result[0]->getId());
     $this->assertTrue($result[0]->hasChildren());
     $this->assertEmpty($result[0]->getChildren());
     $this->assertEquals($page1->getUuid(), $result[1]->getId());
     $this->assertTrue($result[1]->hasChildren());
     $this->assertEmpty($result[1]->getChildren());
     $this->assertEquals($page2->getUuid(), $result[2]->getId());
     $this->assertFalse($result[2]->hasChildren());
     $this->assertEmpty($result[2]->getChildren());
 }