diff --git a/tests/Mods/ModsReaderTest.php b/tests/Mods/ModsReaderTest.php index 346f066..5da6d37 100644 --- a/tests/Mods/ModsReaderTest.php +++ b/tests/Mods/ModsReaderTest.php @@ -833,11 +833,22 @@ public function testGetRecordInfosForBookDocument() self::assertNotEmpty($recordInfos); self::assertEquals(1, count($recordInfos)); self::assertNotEmpty($recordInfos[0]->getValue()); - //self::assertEquals('', $recordInfos[0]->getRecordIdentifier()); - //self::assertNotEmpty($recordInfos[0]->getRecordOrigin()); - //self::assertNotEmpty($recordInfos[0]->getLanguageOfCataloging()); - - // TODO: implement reading of elements + self::assertNotEmpty($recordInfos[0]->getDescriptionStandards()); + self::assertEquals('aacr', $recordInfos[0]->getDescriptionStandards()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordContentSources()); + self::assertEquals('marcorg', $recordInfos[0]->getRecordContentSources()[0]->getAuthority()); + self::assertEquals('DLC', $recordInfos[0]->getRecordContentSources()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordCreationDates()); + self::assertEquals('marc', $recordInfos[0]->getRecordCreationDates()[0]->getEncoding()); + self::assertEquals('990730', $recordInfos[0]->getRecordCreationDates()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordChangeDates()); + self::assertEquals('iso8601', $recordInfos[0]->getRecordChangeDates()[0]->getEncoding()); + self::assertEquals('20060801143536.0', $recordInfos[0]->getRecordChangeDates()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordIdentifiers()); + self::assertEquals('DE-14', $recordInfos[0]->getRecordIdentifiers()[0]->getSource()); + self::assertEquals('11761548', $recordInfos[0]->getRecordIdentifiers()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordOrigins()); + self::assertStringContainsString('Converted from MARCXML to MODS', $recordInfos[0]->getRecordOrigins()[0]->getValue()); } public function testGetRecordInfosByQueryForBookDocument() @@ -846,11 +857,22 @@ public function testGetRecordInfosByQueryForBookDocument() self::assertNotEmpty($recordInfos); self::assertEquals(1, count($recordInfos)); self::assertNotEmpty($recordInfos[0]->getValue()); - //self::assertEquals('', $recordInfos[0]->getRecordIdentifier()); - //self::assertNotEmpty($recordInfos[0]->getRecordOrigin()); - //self::assertNotEmpty($recordInfos[0]->getLanguageOfCataloging()); - - // TODO: implement reading of elements + self::assertNotEmpty($recordInfos[0]->getDescriptionStandards()); + self::assertEquals('aacr', $recordInfos[0]->getDescriptionStandards()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordContentSources()); + self::assertEquals('marcorg', $recordInfos[0]->getRecordContentSources()[0]->getAuthority()); + self::assertEquals('DLC', $recordInfos[0]->getRecordContentSources()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordCreationDates()); + self::assertEquals('marc', $recordInfos[0]->getRecordCreationDates()[0]->getEncoding()); + self::assertEquals('990730', $recordInfos[0]->getRecordCreationDates()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordChangeDates()); + self::assertEquals('iso8601', $recordInfos[0]->getRecordChangeDates()[0]->getEncoding()); + self::assertEquals('20060801143536.0', $recordInfos[0]->getRecordChangeDates()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordIdentifiers()); + self::assertEquals('DE-14', $recordInfos[0]->getRecordIdentifiers()[0]->getSource()); + self::assertEquals('11761548', $recordInfos[0]->getRecordIdentifiers()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordOrigins()); + self::assertStringContainsString('Converted from MARCXML to MODS', $recordInfos[0]->getRecordOrigins()[0]->getValue()); } public function testGetNoRecordInfosByQueryForBookDocument() @@ -865,11 +887,33 @@ public function testGetRecordInfosForSerialDocument() self::assertNotEmpty($recordInfos); self::assertEquals(1, count($recordInfos)); self::assertNotEmpty($recordInfos[0]->getValue()); - //self::assertEquals('', $recordInfos[0]->getRecordIdentifier()); - //self::assertNotEmpty($recordInfos[0]->getRecordOrigin()); - //self::assertNotEmpty($recordInfos[0]->getLanguageOfCataloging()); - - // TODO: implement reading of elements + self::assertNotEmpty($recordInfos[0]->getDescriptionStandards()); + self::assertEquals('aacr', $recordInfos[0]->getDescriptionStandards()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordContentSources()); + self::assertEquals('marcorg', $recordInfos[0]->getRecordContentSources()[0]->getAuthority()); + self::assertEquals('NLC', $recordInfos[0]->getRecordContentSources()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordCreationDates()); + self::assertEquals('marc', $recordInfos[0]->getRecordCreationDates()[0]->getEncoding()); + self::assertEquals('021127', $recordInfos[0]->getRecordCreationDates()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordChangeDates()); + self::assertEquals('iso8601', $recordInfos[0]->getRecordChangeDates()[0]->getEncoding()); + self::assertEquals('20080910160139.0', $recordInfos[0]->getRecordChangeDates()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordIdentifiers()); + self::assertEquals('15446420', $recordInfos[0]->getRecordIdentifiers()[0]->getValue()); + self::assertStringContainsString('Converted from MARCXML to MODS', $recordInfos[0]->getRecordOrigins()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordInfoNotes()); + self::assertEquals(2, count($recordInfos[0]->getRecordInfoNotes())); + self::assertEquals('Some info', $recordInfos[0]->getRecordInfoNotes()[1]->getValue()); + $languages = $recordInfos[0]->getLanguageOfCatalogings(); + self::assertNotEmpty($languages); + self::assertNotNull($languages[0]->getLanguageTerm()); + self::assertEquals('code', $languages[0]->getLanguageTerm()->getType()); + self::assertEquals('iso639-2b', $languages[0]->getLanguageTerm()->getAuthority()); + self::assertEquals('eng', $languages[0]->getLanguageTerm()->getValue()); + self::assertNotNull($languages[0]->getScriptTerm()); + self::assertEquals('code', $languages[0]->getScriptTerm()->getType()); + self::assertEquals('iso15924', $languages[0]->getScriptTerm()->getAuthority()); + self::assertEquals('Latn', $languages[0]->getScriptTerm()->getValue()); } public function testGetRecordInfosByQueryForSerialDocument() @@ -878,11 +922,33 @@ public function testGetRecordInfosByQueryForSerialDocument() self::assertNotEmpty($recordInfos); self::assertEquals(1, count($recordInfos)); self::assertNotEmpty($recordInfos[0]->getValue()); - //self::assertEquals('', $recordInfos[0]->getRecordIdentifier()); - //self::assertNotEmpty($recordInfos[0]->getRecordOrigin()); - //self::assertNotEmpty($recordInfos[0]->getLanguageOfCataloging()); - - // TODO: implement reading of elements + self::assertNotEmpty($recordInfos[0]->getDescriptionStandards()); + self::assertEquals('aacr', $recordInfos[0]->getDescriptionStandards()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordContentSources()); + self::assertEquals('marcorg', $recordInfos[0]->getRecordContentSources()[0]->getAuthority()); + self::assertEquals('NLC', $recordInfos[0]->getRecordContentSources()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordCreationDates()); + self::assertEquals('marc', $recordInfos[0]->getRecordCreationDates()[0]->getEncoding()); + self::assertEquals('021127', $recordInfos[0]->getRecordCreationDates()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordChangeDates()); + self::assertEquals('iso8601', $recordInfos[0]->getRecordChangeDates()[0]->getEncoding()); + self::assertEquals('20080910160139.0', $recordInfos[0]->getRecordChangeDates()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordIdentifiers()); + self::assertEquals('15446420', $recordInfos[0]->getRecordIdentifiers()[0]->getValue()); + self::assertStringContainsString('Converted from MARCXML to MODS', $recordInfos[0]->getRecordOrigins()[0]->getValue()); + self::assertNotEmpty($recordInfos[0]->getRecordInfoNotes()); + self::assertEquals(2, count($recordInfos[0]->getRecordInfoNotes())); + self::assertEquals('Some info', $recordInfos[0]->getRecordInfoNotes()[1]->getValue()); + $languages = $recordInfos[0]->getLanguageOfCatalogings(); + self::assertNotEmpty($languages); + self::assertNotNull($languages[0]->getLanguageTerm()); + self::assertEquals('code', $languages[0]->getLanguageTerm()->getType()); + self::assertEquals('iso639-2b', $languages[0]->getLanguageTerm()->getAuthority()); + self::assertEquals('eng', $languages[0]->getLanguageTerm()->getValue()); + self::assertNotNull($languages[0]->getScriptTerm()); + self::assertEquals('code', $languages[0]->getScriptTerm()->getType()); + self::assertEquals('iso15924', $languages[0]->getScriptTerm()->getAuthority()); + self::assertEquals('Latn', $languages[0]->getScriptTerm()->getValue()); } public function testGetNoRecordInfosByQueryForSerialDocument() diff --git a/tests/resources/mods_book.xml b/tests/resources/mods_book.xml index a656b47..92f56d7 100644 --- a/tests/resources/mods_book.xml +++ b/tests/resources/mods_book.xml @@ -153,8 +153,7 @@ DLC 990730 20060801143536.0 - 11761548 - Converted from MARCXML to MODS version 3.8 using MARC21slim2MODS3-8_XSLT1-0.xsl - (Revision 1.172 20230208) + 11761548 + Converted from MARCXML to MODS version 3.8 using MARC21slim2MODS3-8_XSLT1-0.xsl (Revision 1.172 20230208) diff --git a/tests/resources/mods_serial.xml b/tests/resources/mods_serial.xml index 60ee312..58d3949 100644 --- a/tests/resources/mods_serial.xml +++ b/tests/resources/mods_serial.xml @@ -105,10 +105,12 @@ 021127 20080910160139.0 15446420 - Converted from MARCXML to MODS version 3.8 using MARC21slim2MODS3-8_XSLT1-0.xsl - (Revision 1.172 20230208) + Converted from MARCXML to MODS version 3.8 using MARC21slim2MODS3-8_XSLT1-0.xsl (Revision 1.172 20230208) + Random note + Some info - eng + eng + Latn