Neos\Flow\Tests\Functional\Security\Authorization\Privilege\Entity\Doctrine\ContentSecurityTest::administratorsCanSeeOthersRestrictableEntites PHP Method

administratorsCanSeeOthersRestrictableEntites() public method

    public function administratorsCanSeeOthersRestrictableEntites()
    {
        $ownAccount = $this->authenticateRoles(['Neos.Flow:Administrator', 'Neos.Flow:Customer']);
        $ownAccount->setAccountIdentifier('ownAccount');
        $ownAccount->setAuthenticationProviderName('SomeProvider');
        $otherAccount = new Security\Account();
        $otherAccount->setAccountIdentifier('othersAccount');
        $otherAccount->setAuthenticationProviderName('SomeProvider');
        $this->persistenceManager->add($ownAccount);
        $this->persistenceManager->add($otherAccount);
        $ownEntity = new Fixtures\RestrictableEntity('ownEntity');
        $ownEntity->setOwnerAccount($ownAccount);
        $othersEntity = new Fixtures\RestrictableEntity('othersEntity');
        $othersEntity->setOwnerAccount($otherAccount);
        $this->restrictableEntityDoctrineRepository->add($ownEntity);
        $ownEntityIdentifier = $this->persistenceManager->getIdentifierByObject($ownEntity);
        $this->restrictableEntityDoctrineRepository->add($othersEntity);
        $othersEntityIdentifier = $this->persistenceManager->getIdentifierByObject($othersEntity);
        $this->persistenceManager->persistAll();
        $this->persistenceManager->clearState();
        $result = $this->restrictableEntityDoctrineRepository->findAllWithDql();
        $this->assertTrue(count($result) === 2);
        $this->assertNotNull($this->persistenceManager->getObjectByIdentifier($ownEntityIdentifier, Fixtures\RestrictableEntity::class));
        $this->assertNotNull($this->persistenceManager->getObjectByIdentifier($othersEntityIdentifier, Fixtures\RestrictableEntity::class));
        $this->restrictableEntityDoctrineRepository->removeAll();
        $this->persistenceManager->persistAll();
        $this->persistenceManager->clearState();
    }