find() public method

public find ( $uuid, $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
Ejemplo n.º 1
0
 public function testFindConcreteLanguages()
 {
     $this->initPhpcr();
     $page = $this->createShadowPage('test', 'de', 'en');
     $result = $this->contentRepository->find($page->getUuid(), 'de', 'sulu_io', MappingBuilder::create()->setResolveConcreteLocales(true)->getMapping());
     $this->assertEquals(['de'], $result->getConcreteLanguages());
 }
Ejemplo n.º 2
0
 public function testFindPermissions()
 {
     $this->initPhpcr();
     $role1 = $this->prophesize(RoleInterface::class);
     $role1->getId()->willReturn(1);
     $role1->getIdentifier()->willReturn('ROLE_1');
     $role2 = $this->prophesize(RoleInterface::class);
     $role2->getId()->willReturn(2);
     $role2->getIdentifier()->willReturn('ROLE_2');
     $user = $this->prophesize(UserInterface::class);
     $user->getRoleObjects()->willReturn([$role1->reveal(), $role2->reveal()]);
     $page = $this->createPage('test-1', 'de', [], null, [1 => 'edit', 2 => 'view archive', 3 => 'add']);
     $result = $this->contentRepository->find($page->getUuid(), 'de', 'sulu_io', MappingBuilder::create()->getMapping(), $user->reveal());
     $this->assertEquals([1 => ['edit' => true], 2 => ['view' => true, 'archive' => true]], $result->getPermissions());
 }