Beispiel #1
0
 /**
  * @expectedException Oai_Model_Exception
  * @expectedExceptionMessage access to requested document files is embargoed
  */
 public function testGetAccessibleFilesForEmbargoedDocument()
 {
     $this->enableSecurity();
     $doc = $this->createTestDocument();
     $doc->setServerState('published');
     // set embargo date to tomorrow
     $date = new Opus_Date();
     $date->setDateTime(new DateTime('tomorrow'));
     $doc->setEmbargoDate($date);
     // add a file visible in OAI
     $file = $this->createTestFile('foo.pdf');
     $file->setVisibleInOai(true);
     $doc->addFile($file);
     $doc->store();
     $this->assertFalse($doc->hasEmbargoPassed());
     // not yet passed
     $container = new Oai_Model_Container($doc->getId());
     $files = $container->getAccessibleFiles();
     $this->assertCount(1, $files);
 }