public function testTransitionDeny()
 {
     $this->calls = array();
     $documentManager = $this->documentManager;
     $eventManager = $documentManager->getEventManager();
     $eventManager->addEventListener(Events::TRANSITION_DENIED, $this);
     $testDoc = new AccessControlled();
     $testDoc->setName('nice doc');
     $testDoc->setState('review');
     $documentManager->persist($testDoc);
     $documentManager->flush();
     $this->assertEquals('review', $testDoc->getState());
     $testDoc->setState('published');
     $documentManager->flush();
     $this->assertEquals('review', $testDoc->getState());
     $this->assertTrue(isset($this->calls[Events::TRANSITION_DENIED]));
 }
 public function testReadAccess()
 {
     $documentManager = $this->documentManager;
     $eventManager = $documentManager->getEventManager();
     $testDoc = new AccessControlled();
     $testDoc->setName('read doc');
     $testDoc->setState('draft');
     $documentManager->persist($testDoc);
     $documentManager->flush();
     $documentManager->clear();
     $testDoc = $documentManager->getRepository(get_class($testDoc))->find($testDoc->getId());
     $this->assertNotNull($testDoc);
     $testDoc->setState('review');
     $documentManager->flush();
     $documentManager->clear();
     $testDoc = $documentManager->getRepository(get_class($testDoc))->find($testDoc->getId());
     $this->assertNull($testDoc);
 }