public function customersCannotSeeTestEntityAAssociatedToATestEntityBSomeoneElsesAccount()
{
$cacheManager = $this->objectManager->get(CacheManager::class);
$cacheManager->getCache('Flow_Persistence_Doctrine')->flush();
$myAccount = $this->authenticateRoles(['Neos.Flow:Customer']);
$myAccount->setAccountIdentifier('MyAccount');
$myAccount->setAuthenticationProviderName('SomeProvider');
$andisAccount = new Security\Account();
$andisAccount->setAccountIdentifier('Andi');
$andisAccount->setAuthenticationProviderName('SomeProvider');
$this->persistenceManager->add($myAccount);
$this->persistenceManager->add($andisAccount);
$testEntityB = new Fixtures\TestEntityB('testEntityB');
$testEntityB->setOwnerAccount($myAccount);
$testEntityA = new Fixtures\TestEntityA($testEntityB);
$testEntityB2 = new Fixtures\TestEntityB('testEntityB2');
$testEntityB2->setOwnerAccount($andisAccount);
$testEntityA2 = new Fixtures\TestEntityA($testEntityB2);
$this->testEntityADoctrineRepository->add($testEntityA);
$this->testEntityADoctrineRepository->add($testEntityA2);
$testEntityAIdentifier = $this->persistenceManager->getIdentifierByObject($testEntityA);
$testEntityA2Identifier = $this->persistenceManager->getIdentifierByObject($testEntityA2);
$this->persistenceManager->persistAll();
$this->persistenceManager->clearState();
$result = $this->testEntityADoctrineRepository->findAllWithDql();
$this->assertTrue(count($result) === 1);
$this->assertNotNull($this->persistenceManager->getObjectByIdentifier($testEntityAIdentifier, Fixtures\TestEntityA::class));
$this->assertNull($this->persistenceManager->getObjectByIdentifier($testEntityA2Identifier, Fixtures\TestEntityA::class));
$this->restrictableEntityDoctrineRepository->removeAll();
$this->persistenceManager->persistAll();
$this->persistenceManager->clearState();
}