/** * Regression test for existing thesis:* and ddb:* elements */ public function testGetRecordXMetaDissPlusDoc146ThesisAndDdb() { $doc = new Opus_Document(146); $this->assertEquals('masterthesis', $doc->getType(), 'testdata changed: document type changed'); $this->assertEquals('published', $doc->getServerState(), 'testdata changed: document state changed'); $this->assertEquals(2, count($doc->getThesisGrantor()), 'testdata changed: thesis grantor added to document'); $this->assertEquals(2, count($doc->getThesisPublisher()), 'testdata changed: thesis publisher added to document'); $this->dispatch('/oai?verb=GetRecord&metadataPrefix=XMetaDissPlus&identifier=oai::146'); $this->assertResponseCode(200); $response = $this->getResponse(); $xpath = $this->prepareXpathFromResultString($response->getBody()); // Regression test for OPUSVIER-2452 - existing thesis:grantor element $elements = $xpath->query('//thesis:degree/thesis:grantor'); $this->assertEquals(2, $elements->length, "Unexpected thesis:grantor count"); // Regression test for OPUSVIER-2523 - existing ddb:contact element $elements = $xpath->query('//ddb:contact/@ddb:contactID'); $this->assertEquals(1, $elements->length, "Unexpected ddb:contact count"); $this->assertEquals('Lxxxx-xxxx', $elements->item(0)->nodeValue, "Wrong ddb:contact"); // Testing for other existing elements $elements = $xpath->query('//thesis:degree/thesis:level[text()="master"]'); $this->assertEquals(1, $elements->length, "Unexpected thesis:level=='master' count"); $elements = $xpath->query('//thesis:degree/thesis:grantor/cc:universityOrInstitution/cc:name'); $this->assertEquals(2, $elements->length, "Unexpected thesis:level=='master' count"); }
} if (!is_null($thesisPublisherId)) { $thesisPublisher = $doc->getThesisPublisher(); if (empty($thesisPublisher)) { if (!$dryrun) { $doc->setThesisPublisher($dnbInstitute); $doc->store(); } _log("Setting ThesisPublisher <{$thesisPublisherId}> on Document <{$docId}>"); } else { $existingThesisPublisherId = $thesisPublisher[0]->getId(); _log("ThesisPublisher <{$existingThesisPublisherId[1]}> already set for Document <{$docId}>"); } } if (!is_null($thesisGrantorId)) { $thesisGrantor = $doc->getThesisGrantor(); if (empty($thesisGrantor)) { if (!$dryrun) { $doc->setThesisGrantor($dnbInstitute); $doc->store(); } _log("Setting ThesisGrantor <{$thesisGrantorId}> on Document <{$docId}>"); } else { $existingThesisGrantorId = $thesisGrantor[0]->getId(); _log("ThesisGrantor <{$existingThesisGrantorId[1]}> already set for Document <{$docId}>"); } } } catch (Exception $exc) { _log("Error processing Document with ID {$docId}!"); _log($exc->getMessage()); }