public function testCreate() { $this->markTestIncomplete('No hash in test data.'); $doc = new Opus_Document(91); $files = $doc->getFiles(); $file = $files[0]; }
/** * Function is only called if document was modified. * * @see {Opus_Model_Plugin_Interface::postStore} */ public function postStore(Opus_Model_AbstractDb $model) { $logger = Zend_Registry::get('Zend_Log'); if (null !== $logger) { $logger->debug('Opus_Document_Plugin_XmlCache::postStore() with id ' . $model->getId()); } // TODO can that be eleminated? why is it necessary? $model = new Opus_Document($model->getId()); $cache = new Opus_Model_Xml_Cache(); $omx = new Opus_Model_Xml(); // remove document from cache. This can always be done, because postStore is only called if model was modified. $cache->removeAllEntriesWhereDocumentId($model->getId()); // refresh cache (TODO does it make sense?) $omx->setStrategy(new Opus_Model_Xml_Version1())->excludeEmptyFields()->setModel($model)->setXmlCache($cache); $dom = $omx->getDomDocument(); // Skip caching of XML-Version2. // TODO why? $index_version_two = false; if ($index_version_two) { // xml version 2 $omx = new Opus_Model_Xml(); $omx->setStrategy(new Opus_Model_Xml_Version2())->setModel($model)->setXmlCache($cache); $dom = $omx->getDomDocument(); } }
/** * @return boolean */ private function checkPermission() { if ($this->_document->getServerState() === 'published') { return true; } $accessControl = Zend_Controller_Action_HelperBroker::getStaticHelper('accessControl'); return Opus_Security_Realm::getInstance()->checkDocument($this->_document->getId()) || $accessControl->accessAllowed('documents'); }
/** * Returns the number of a document in a series. * @param Opus_Document $document * @param Opus_Series $series * @return string */ public function seriesNumber($document, $series) { foreach ($document->getSeries() as $linkedSeries) { if ($linkedSeries->getModel()->getId() === $series->getId()) { return htmlspecialchars($linkedSeries->getNumber()); } } return ''; }
/** * Returns all authors for the given document. Returns an empty array in case * no authors exists. * * @return array An array of authors for the given document. */ public function getAuthors() { $authors = array(); foreach ($this->_document->getPersonAuthor() as $author) { $authorId = $author->getId(); array_push($authors, array('id' => $authorId[0], 'name' => $author->getName(), 'mail' => $author->getEmail(), 'allowMail' => $author->getAllowEmailContact())); } return $authors; }
/** * Dieser Test soll sicherstellen, das updateModel überschrieben wurde und das Dokument in Ruhe lässt. */ public function testUpdateModel() { $form = new Admin_Form_Document_SubjectType('swd'); // Formular ohne Schlagwörter $document = new Opus_Document(200); $this->assertEquals(2, count($document->getSubject())); $form->updateModel($document); // würde normalerweise alle Subjects löschen, wurde aber überschrieben $this->assertEquals(2, count($document->getSubject())); }
public function testGetModel() { $form = new Admin_Form_PersonLink(); $this->assertNull($form->getModel()); $document = new Opus_Document(250); $authors = $document->getPersonAuthor(); $this->assertEquals(3, count($authors)); $form->populateFromModel($authors[0]); $this->assertEquals($authors[0], $form->getModel()); }
/** * Sammelt Schlagwoerter von Unterformularen ein und aktualisiert Dokument. * @param Opus_Document $document */ public function updateModel($document) { $subforms = $this->getSubForms(); $subjects = array(); foreach ($subforms as $subform) { $subjectsWithType = $subform->getSubFormModels(); $subjects = array_merge($subjects, $subjectsWithType); } $document->setSubject($subjects); }
public function tearDown() { if ($this->documentImported) { $ids = Opus_Document::getAllIds(); $last_id = array_pop($ids); $doc = new Opus_Document($last_id); $doc->deletePermanent(); } parent::tearDown(); }
public function testKeepDocumentNewerThan3Days() { $this->changeDocumentDateModified(2); $this->executeScript('cron-db-clean-temporary.php'); try { $doc = new Opus_Document($this->doc->getId()); $doc->deletePermanent(); } catch (Opus_Model_NotFoundException $e) { $this->fail("expected existing document."); } }
/** * Load initialized document object (and check document status). * * @param type $documentId * @return Opus_Document * @throws Publish_Model_Exception */ public function loadDocument($documentId) { if (!isset($documentId) or !preg_match('/^\\d+$/', $documentId)) { throw new Publish_Model_Exception('Invalid document ID given'); } $this->document = new Opus_Document($documentId); if ($this->document->getServerState() !== self::DOCUMENT_STATE) { throw new Publish_Model_Exception('Document->ServerState mismatch!'); } return $this->document; }
public function indexAction() { $docId = $this->getRequest()->getParam("docId"); if (isset($docId) === FALSE) { throw new Exception("docId must be set"); } $this->view->docId = $docId; $document = new Opus_Document($docId); $titles = $document->getTitleMain(); $authors = $document->getPersonAuthor(); $session = new Zend_Session_Namespace(); if (isset($session->language)) { $language = $session->language; } else { $language = 'en'; } foreach ($titles as $title) { if ($title->getLanguage() == $language) { $this->view->title = $title->getValue(); } } $authorsArray = array(); foreach ($authors as $author) { $authorsArray[] = $author->getName(); } $this->view->authors = implode(', ', $authorsArray); //get statistics from db for total count and for image tag (accessibility) $statistic = Opus_Statistic_LocalCounter::getInstance(); $totalAbstractPage = $statistic->readTotal($docId, 'frontdoor'); $totalFiles = $statistic->readTotal($docId, 'files'); $yearAbstractPage = $statistic->readYears($docId, 'frontdoor'); $yearFiles = $statistic->readYears($docId, 'files'); $this->view->totalAbstractPage = $totalAbstractPage; $this->view->totalFiles = $totalFiles; $years = array_merge(array_keys($yearAbstractPage), array_keys($yearFiles)); if (count($years) == 0) { $years = array(date('Y')); } foreach ($years as $year) { if (isset($yearFiles[$year]) === false) { $yearFiles[$year] = 0; } if (isset($yearAbstractPage[$year]) === false) { $yearAbstractPage[$year] = 0; } } ksort($yearFiles); ksort($yearAbstractPage); foreach (array_keys($yearAbstractPage) as $year) { $lines[] = $year . ': ' . $yearAbstractPage[$year] . ', ' . $yearFiles[$year]; } $this->view->altTextStat = implode('; ', $lines); }
public function testStoreEnrichmentKeyValueSkipDuplicate() { $doc = $this->createTestDocument(); $docId = $doc->store(); $this->assertEquals(0, count($doc->getEnrichment())); $mmd = new Matheon_Model_Document($docId); $mmd->storeEnrichmentKeyValue('reviewer.user_id', 123); $mmd->storeEnrichmentKeyValue('reviewer.user_id', 124); $mmd->storeEnrichmentKeyValue('reviewer.user_id', 123); $mmd->store(); $doc = new Opus_Document($docId); $this->assertEquals(2, count($doc->getEnrichment())); }
public function testGetLinkModel() { $form = new Admin_Form_Document_Person(); $document = new Opus_Document(146); $authors = $document->getPersonAuthor(); $form->populateFromModel($authors[0]); $form->getElement('Role')->setValue(null); // nicht teil des POST beim Metadaten-Formular $person = $form->getLinkModel(146, 'author'); $this->assertEquals($person->getId(), $authors[0]->getId()); $this->assertNotNull($person->getModel()); $this->assertEquals('author', $person->getRole()); }
public function testGetModel() { $form = new Admin_Form_Document_Abstract(); $doc = new Opus_Document(146); $abstracts = $doc->getTitleAbstract(); $abstract = $abstracts[0]; $form->getElement('Id')->setValue($abstract->getId()); $form->getElement('Language')->setValue('eng'); $form->getElement('Value')->setValue('Test Zusammenfassung!'); $model = $form->getModel(); $this->assertEquals($abstract->getId(), $model->getId()); $this->assertEquals('eng', $model->getLanguage()); $this->assertEquals('Test Zusammenfassung!', $model->getValue()); }
public function testGetModel() { $form = new Admin_Form_Document_Note(); $doc = new Opus_Document(146); $notes = $doc->getNote(); $note = $notes[0]; $form->getElement('Id')->setValue($note->getId()); $form->getElement('Visibility')->setChecked(true); $form->getElement('Message')->setValue('Test Message'); $model = $form->getModel(); $this->assertEquals($note->getId(), $model->getId()); $this->assertEquals('public', $model->getVisibility()); $this->assertEquals('Test Message', $model->getMessage()); }
public function testGetModel() { $form = new Admin_Form_Document_Title(); $doc = new Opus_Document(146); $titles = $doc->getTitleMain(); $title = $titles[0]; $form->getElement('Id')->setValue($title->getId()); $form->getElement('Type')->setValue('parent'); $form->getElement('Language')->setValue('rus'); $form->getElement('Value')->setValue('Test Title'); $model = $form->getModel(); $this->assertEquals($title->getId(), $model->getId()); $this->assertEquals('parent', $model->getType()); $this->assertEquals('rus', $model->getLanguage()); $this->assertEquals('Test Title', $model->getValue()); }
public function testGetModel() { $form = new Admin_Form_Document_Series(); $doc = new Opus_Document(146); $series = $doc->getSeries(); $form->getElement('Id')->setValue($doc->getId()); $form->getElement('SeriesId')->setValue($series[0]->getModel()->getId()); $form->getElement('Number')->setValue('b'); $form->getElement('SortOrder')->setValue(7); $model = $form->getModel(); $modelId = $model->getId(); $this->assertEquals(146, $modelId[0]); $this->assertEquals($series[0]->getModel()->getId(), $modelId[1]); $this->assertEquals('b', $model->getNumber()); $this->assertEquals(7, $model->getDocSortOrder()); }
private function isFileAccessAllowed($file, $realm) { if (is_null($file) or !$realm instanceof Opus_Security_IRealm) { return false; } return $realm->checkFile($file->getId()) && $file->getVisibleInFrontdoor() && $this->_doc->hasEmbargoPassed() || $this->getAclHelper()->accessAllowed('documents'); }
public function testGetModel() { $form = new Admin_Form_Document_Enrichment(); $document = new Opus_Document(146); $enrichments = $document->getEnrichment(); $enrichment = $enrichments[0]; $keyNames = $enrichment->getField('KeyName')->getDefault(); $keyName = $keyNames[1]->getName(); // Geht davon aus, dass mindestens 2 Enrichment Keys existieren $form->getElement('Id')->setValue($enrichment->getId()); $form->getElement('KeyName')->setValue($keyName); $form->getElement('Value')->setValue('Test Enrichment Value'); $model = $form->getModel(); $this->assertEquals($enrichment->getId(), $model->getId()); $this->assertEquals($keyName, $model->getKeyName()); $this->assertEquals('Test Enrichment Value', $model->getValue()); }
public function testGetModel() { $form = new Admin_Form_Document_Institute(Admin_Form_Document_Institute::ROLE_PUBLISHER); $doc = new Opus_Document(146); $publishers = $doc->getThesisPublisher(); $publisher = $publishers[0]; $publisherId = $publisher->getModel()->getId(); $form->getElement('Id')->setValue($doc->getId()); $form->getElement('Institute')->setValue($publisherId); $model = $form->getModel(); $modelId = $model->getId(); $this->assertNotNull($model); $this->assertNotNull($modelId); $this->assertEquals($doc->getId(), $modelId[0]); $this->assertEquals($publisherId, $modelId[1]); $this->assertEquals('publisher', $modelId[2]); $this->assertEquals($publisherId, $model->getModel()->getId()); }
/** * Bereitet Formular fuer Anzeige als View vor. * * Fuegt Unterformular fuer Dateien hinzu. Dateien sind nicht Teil des Metadaten-Formulars, werden aber in der * Metadaten-Übersicht mit aufgelistet. */ public function prepareRenderingAsView() { parent::prepareRenderingAsView(); if (!is_null($this->document)) { if (count($this->document->getFile()) > 0) { $subform = new Admin_Form_Document_Files(); $subform->populateFromModel($this->document); $this->addSubForm($subform, 'Files'); } } }
/** * * @param Opus_Document $document das Dokument auf das sich die Notifizierung bezieht * @param String $context Notifizierungskontext * @param String $url vollständiger Deeplink, der in der Mail angezeigt werden soll * @param boolean $notifySubmitter Wenn false, wird der Submitter nicht notifiziert * @param array $notifyAuthors Bitmaske, die für jeden Autor (über den Index referenziert) angibt, ob ihm/ihr eine * E-Mail gesendet werden kann (wenn false, dann wird keine Notifizierung versendet) */ public function prepareMail($document, $context, $url, $notifySubmitter = true, $notifyAuthors = array()) { if (!$this->validateContext($context)) { $this->logger->err("context {$context} is currently not supported or delivery of notification mails is not" . ' enabled for the current context'); return; } $this->logger->info("prepare {$context} notification email for document id " . $document->getId()); $authorAddresses = array(); $authors = array(); $title = ""; $personAuthors = $document->getPersonAuthor(); if (!empty($personAuthors)) { $index = 0; foreach ($personAuthors as $author) { $name = trim($author->getLastName() . ", " . $author->getFirstName()); // TODO Komma nur wenn FirstName present array_push($authors, $name); if ($context == self::PUBLICATION) { $email = trim($author->getEmail()); if (!empty($email) && (empty($notifyAuthors) || isset($notifyAuthors[$index]) && $notifyAuthors[$index])) { array_push($authorAddresses, array("name" => $name, "address" => $email)); } } $index++; } } // TODO Funktionalität existiert bereits (Documents Helper oder so) $titlesMain = $document->getTitleMain(); if (!empty($titlesMain)) { // ermittle (den ersten) TitleMain in Dokumentsprache $language = $document->getLanguage(); foreach ($titlesMain as $titleMain) { if ($titleMain->getLanguage() == $language) { $title = trim($titleMain->getValue()); break; } } } $this->scheduleNotification($this->getMailSubject($context, $document->getId(), $authors, $title), $this->getMailBody($context, $document->getId(), $authors, $title, $url), $this->getRecipients($context, $authorAddresses, $document, $notifySubmitter)); $this->logger->info("{$context} notification mail creation was completed successfully"); }
/** * Loads an old Opus ID * * @param Opus_Document $object Opus-Document for that the files should be registered * @return void */ public function loadSignatureFiles($id) { $object = new Opus_Document($id); $this->_tmpPath = null; $opusId = $object->getIdentifierOpus3()->getValue(); // Search the ID-directory in signaturefiles tree $this->searchDir($this->_path, $opusId); foreach ($object->getFile() as $file) { $sigfiles = $this->getFiles($this->_tmpPath, $file->getPathName()); if (count($sigfiles) > 0) { $key = 0; foreach ($sigfiles as $signatureFile) { $registered = false; $signature = implode("", file($signatureFile)); // check if this signature has been registered $hashes = $file->getHashValue(); foreach ($hashes as $hash) { if (substr($hash->getType(), 0, 4) === 'gpg-') { $key++; if ($signature === $hash->getValue()) { $registered = true; } } } // if not, add the signature if ($registered === false) { $hash = new Opus_HashValues(); $hash->setType('gpg-' . $key); $hash->setValue($signature); $file->addHashValue($hash); } unset($signatureFile); } } unset($file); } // Store signature(s) directly $object->store(); }
public function getSubmitter() { $return = array(); foreach ($this->document->getEnrichment() as $e) { if ($e->getKeyName() != 'submitter.user_id') { continue; } $user_id = $e->getValue(); $account = new Opus_Account($user_id); $return[$account->getId()] = strtolower($account->getLogin()); } return $return; }
/** * Returns all associated Opus_File objects that are visible in OAI and accessible by user * @return array Accessible Opus_File objects * * TODO check embargo date * TODO merge access checks with code for deliver controller */ public function getAccessibleFiles() { $realm = Opus_Security_Realm::getInstance(); // admins sollen immer durchgelassen werden, nutzer nur wenn das doc im publizierten Zustand ist if (!$realm->skipSecurityChecks()) { // kein administrator // PUBLISHED Dokumente sind immer verfügbar (Zugriff auf Modul kann eingeschränkt sein) if ($this->_doc->getServerState() !== 'published') { // Dokument nicht published if (!$realm->checkDocument($this->_docId)) { // Dokument ist nicht verfügbar für aktuellen Nutzer $this->logErrorMessage('document id =' . $this->_docId . ' is not published and access is not allowed for current user'); throw new Oai_Model_Exception('access to requested document is forbidden'); } } if ($this->_doc->hasEmbargoPassed() === false) { if (!$realm->checkDocument($this->_docId)) { // Dokument ist nicht verfügbar für aktuellen Nutzer $this->logErrorMessage('document id =' . $this->_docId . ' is not embargoed and access is not allowed for current user'); throw new Oai_Model_Exception('access to requested document files is embargoed'); } } } $files = array(); $filesToCheck = $this->_doc->getFile(); /* @var $file Opus_File */ foreach ($filesToCheck as $file) { $filename = $this->_appConfig->getFilesPath() . $this->_docId . DIRECTORY_SEPARATOR . $file->getPathName(); if (is_readable($filename)) { array_push($files, $file); } else { $this->logErrorMessage("skip non-readable file {$filename}"); } } if (empty($files)) { $this->logErrorMessage('document with id ' . $this->_docId . ' does not have any associated files'); throw new Oai_Model_Exception('requested document does not have any associated readable files'); } $containerFiles = array(); /* @var $file Opus_File */ foreach ($files as $file) { if ($file->getVisibleInOai() && $realm->checkFile($file->getId())) { array_push($containerFiles, $file); } } if (empty($containerFiles)) { $this->logErrorMessage('document with id ' . $this->_docId . ' does not have associated files that are accessible'); throw new Oai_Model_Exception('access denied on all files that are associated to the requested document'); } return $containerFiles; }
/** * make sure documents related to Collection[Role|]s in subtree are updated * (XML-Cache and server_date_published) * * @param Opus_Collection Starting point for recursive update to documents */ protected function updateDocuments($model) { if (is_null($model) || is_null($model->getId())) { // TODO explain why this is right return; } $collections = Opus_Db_TableGateway::getInstance('Opus_Db_Collections'); $collectionIdSelect = $collections->selectSubtreeById($model->getId(), 'id'); $documentFinder = new Opus_DocumentFinder(); $documentFinder->setCollectionId($collectionIdSelect); // clear affected documents from cache $xmlCache = new Opus_Model_Xml_Cache(); $xmlCache->removeAllEntriesWhereSubSelect($documentFinder->getSelectIds()); // update ServerDateModified for affected documents $date = new Opus_Date(); $date->setNow(); Opus_Document::setServerDateModifiedByIds($date, $documentFinder->ids()); }
/** * Render body of notification mail. * * @param string $baseUrlServer * @param string $baseUrlFiles * @return string */ public function renderPublishMailBody($baseUrlServer, $baseUrlFiles) { $baseUrlServer = preg_replace('/[\\/]+$/', '', $baseUrlServer); $baseUrlFiles = preg_replace('/[\\/]+$/', '', $baseUrlFiles); $loggedUserModel = new Publish_Model_LoggedUser(); $person = $loggedUserModel->createPerson(); $submitterString = ''; if (!is_null($person) and $person->isValid()) { $submitterString = trim($person->getFirstName() . " " . $person->getLastName()); } $titleModels = $this->_document->getTitleMain(); $titleString = ''; if (count($titleModels) > 0) { $titleString = trim($titleModels[0]->getValue()); } $abstractModels = $this->_document->getTitleAbstract(); $abstractString = ''; if (count($abstractModels) > 0) { $abstractString = trim($abstractModels[0]->getValue()); } $template = new Matheon_Model_Template(); $template->template = APPLICATION_PATH . '/modules/matheon/models/confirmation-mail.template'; return $template->render(array('baseUrlServer' => $baseUrlServer, 'baseUrlFiles' => $baseUrlFiles, 'docId' => $this->getId(), 'submitterString' => $submitterString, 'titleString' => $titleString, 'abstractString' => $abstractString, 'files' => $this->_document->getFile())); }
/** * Im Rahmen der Zuweisung von Dokumenten, die Collections der Collection Role * series zugeordnet sind, müssen verschiedene Konflikte behandelt werden. * * Im Folgenden werden nur Dokumente betrachtet, die mindestens einer Collection * der Collection Role series (kurz: series-Collection) zugeordnet sind. * * Fall 1 (Dokumente ohne IdentifierSerial): * Da die Bandnummer einer Schriftenreihe Opus_Series obligatorisch ist, können * Dokumente ohne IdentifierSerial nicht migriert werden. Sie verbleiben * unangetastet. Die Zuweisung(en) zu series-Collection(s) wird (werden) nicht * verändert. * * Fall 2 (Dokumente mit mehr als einem IdentifierSerial): * Da ein Dokument pro Schriftenreihe nur eine Bandnummer besitzen kann, können * Dokumente mit mehr als einem Wert für das Feld IdentifierSerial nicht * migriert werden. Sie verbleiben unangetastet. Die Zuweisung(en) zu * series-Collection(s) wird (werden) nicht verändert. * * Fall 3 (Dokumente mit einem IdentifierSerial): * Da in einer Schriftenreihe nicht zwei Dokumente mit der gleichen Bandnummer * existieren können, muss beim Zuweisen von Dokumenten darauf geachtet werden, * dass eine Bandnummer nicht mehrfach vergeben wird. * Wird versucht ein Dokument zu einer Schriftenreihe mit einer bereits * in Benutzung befindlichen Bandnummer zuzuweisen, so wird die Zuweisung * nicht durchgeführt. Die Zuweisung des Dokuments zur series-Collection wird * in diesem Fall unverändert beibehalten. * * Im Falle der erfolgreichen Zuweisung des Dokuments zu einer Schriftenreihe * wird die Verknüpfung mit der korrespondierenden series-Collection * entfernt. Außerdem wird das Feld IdentifierSerial entfernt. * * * @return array an array that contains both the number of conflicts found and * the number of documents that were successfully migrated */ private function migrateDocuments() { $numOfConflicts = 0; $numOfDocsMigrated = 0; $finder = new Opus_DocumentFinder(); $finder->setCollectionRoleId($this->seriesRole->getId()); $serialIdsInUse = array(); foreach ($finder->ids() as $docId) { $doc = new Opus_Document($docId); $serialIds = $doc->getIdentifierSerial(); $numOfSerialIds = count($serialIds); if ($numOfSerialIds == 0) { $this->logger->warn("doc #{$docId} : does not have a field IdentifierSerial -- leave it untouched"); $numOfConflicts++; continue; } if ($numOfSerialIds > 1) { $this->logger->warn("doc #{$docId} : has {$numOfSerialIds} values for field IdentifierSerial -- leave it untouched"); $numOfConflicts++; continue; } $serialId = $serialIds[0]->getValue(); $remainingCollections = array(); foreach ($doc->getCollection() as $collection) { // only consider collection in collection role series if ($collection->getRoleId() != $this->seriesRole->getId()) { array_push($remainingCollections, $collection); } else { $collectionId = $collection->getId(); if (!$collection->isRoot()) { // check for conflict if (array_key_exists($collectionId, $serialIdsInUse) && in_array($serialId, $serialIdsInUse[$collectionId])) { // conflict was found: serialId for series $collectionId already in use $this->logger->warn("doc #{$docId} : could not assign to series #{$collectionId}: value {$serialId} already in use"); $this->logger->warn("doc #{$docId} : leave assignment to collection #{$collectionId} untouched"); array_push($remainingCollections, $collection); $numOfConflicts++; } else { // no conflict $series = new Opus_Series($collectionId); $doc->addSeries($series)->setNumber($serialId); $doc->setIdentifierSerial(array()); // mark usage of serialId for collection $collectionId if (array_key_exists($collectionId, $serialIdsInUse)) { array_push($serialIdsInUse[$collectionId], $serialId); } else { $serialIdsInUse[$collectionId] = array($serialId); } $this->logger->info("doc #{$docId} : assign document to series #{$collectionId} with value {$serialId}"); $this->logger->info("doc #{$docId} : removed assignment from collection #{$collectionId}"); $this->logger->info("doc #{$docId} : removed field IdentifierSerial with value " . $serialId); $numOfDocsMigrated++; } } else { // series root collection assignment will not be migrated $this->logger->warn("doc #{$docId} : is assigned to root collection #{$collectionId} of collection role series: leave assignment untouched"); array_push($remainingCollections, $collection); $numOfConflicts++; } } } $doc->setCollection($remainingCollections); $doc->unregisterPlugin('Opus_Document_Plugin_Index'); $doc->store(); } return array('numOfConflicts' => $numOfConflicts, 'numOfDocsMigrated' => $numOfDocsMigrated); }
/** * Regression Test for OPUSVIER-2646 */ public function testFormManipulationForBibliography() { $this->markTestIncomplete('testing multipart formdata not yet solved'); $config = Zend_Registry::get('Zend_Config'); $oldval = null; if (isset($config->form->first->bibliographie)) { $oldval = $config->form->first->bibliographie; } $config->form->first->bibliographie = 0; $this->request->setMethod('POST')->setPost(array('documentType' => 'demo', 'MAX_FILE_SIZE' => '10240000', 'fileupload' => '', 'uploadComment' => '', 'bibliographie' => '1', 'rights' => '1', 'send' => 'Weiter zum nächsten Schritt')); $this->dispatch('/publish/form/upload'); $session = new Zend_Session_Namespace('Publish'); // undo config changes if (is_null($oldval)) { unset($config->form->first->bibliographie); } else { $config->form->first->bibliographie = $oldval; } $doc = new Opus_Document($session->documentId); $belongsToBibliography = $doc->getBelongsToBibliography(); $doc->deletePermanent(); $this->assertResponseCode(200); $this->assertNotContains("Es sind Fehler aufgetreten.", $this->response->getBody()); $this->assertFalse((bool) $belongsToBibliography, 'Expected that document does not belong to bibliography'); }