public function testPartialReadDeny()
 {
     $documentManager = $this->documentManager;
     $testDoc = new User();
     $testDoc->setUsername('testUser');
     $testDoc->setProfile(new Profile('john', 'smith'));
     $documentManager->persist($testDoc);
     $documentManager->flush();
     $documentManager->clear();
     $testDoc = $documentManager->getRepository(get_class($testDoc))->find($testDoc->getId());
     $this->assertEquals('testUser', $testDoc->getUsername());
     $this->assertNull($testDoc->getProfile());
 }
Ejemplo n.º 2
0
 public function testCreateAllow()
 {
     $this->calls = array();
     $documentManager = $this->documentManager;
     $eventManager = $documentManager->getEventManager();
     $eventManager->addEventListener(AccessControlEvents::CREATE_DENIED, $this);
     $testDoc = new User();
     $testDoc->setUsername('testUser');
     $testDoc->setProfile(new Profile('john', 'smith'));
     $documentManager->persist($testDoc);
     $documentManager->flush();
     $documentManager->clear();
     $testDoc = $documentManager->getRepository(get_class($testDoc))->find($testDoc->getId());
     $this->assertEquals('john', $testDoc->getProfile()->getFirstName());
     $this->assertFalse(isset($this->calls[AccessControlEvents::CREATE_DENIED]));
 }