diff --git a/tests/Mods/ModsReaderTest.php b/tests/Mods/ModsReaderTest.php index b34bed2..e8556c0 100644 --- a/tests/Mods/ModsReaderTest.php +++ b/tests/Mods/ModsReaderTest.php @@ -787,8 +787,18 @@ public function testGetPartsForBookDocument() self::assertEquals('poem', $parts[0]->getType()); self::assertNotEmpty($parts[0]->getOrder()); self::assertEquals(1, $parts[0]->getOrder()); - - // TODO: implement reading of elements + self::assertNotEmpty($parts[0]->getDetails()); + self::assertNotEmpty($parts[0]->getDetails()[0]->getTitles()); + self::assertEquals('Wayfarers', $parts[0]->getDetails()[0]->getTitles()[0]->getValue()); + self::assertNotEmpty($parts[0]->getExtents()); + self::assertEquals('pages', $parts[0]->getExtents()[0]->getUnit()); + self::assertEquals('97', $parts[0]->getExtents()[0]->getStart()->getValue()); + self::assertEquals('98', $parts[0]->getExtents()[0]->getEnd()->getValue()); + self::assertNotEmpty($parts[0]->getDates()); + self::assertEquals('marc', $parts[0]->getDates()[0]->getEncoding()); + self::assertEquals('1989', $parts[0]->getDates()[0]->getValue()); + self::assertNotEmpty($parts[0]->getTexts()); + self::assertEquals('Some random text', $parts[0]->getTexts()[0]->getValue()); } public function testGetPartsByQueryForBookDocument() @@ -801,8 +811,18 @@ public function testGetPartsByQueryForBookDocument() self::assertEquals('poem', $parts[0]->getType()); self::assertNotEmpty($parts[0]->getOrder()); self::assertEquals(2, $parts[0]->getOrder()); - - // TODO: implement reading of elements + $details = $parts[0]->getDetails(); + self::assertNotEmpty($details); + self::assertEquals(2, count($details)); + self::assertEquals('begin', $details[0]->getType()); + self::assertEquals(1, $details[0]->getLevel()); + self::assertNotEmpty($details[0]->getTitles()); + self::assertEquals('Vagabonds', $details[0]->getTitles()[0]->getValue()); + self::assertNotEmpty($parts[0]->getExtents()); + self::assertEquals('pages', $parts[0]->getExtents()[0]->getUnit()); + self::assertEquals('99', $parts[0]->getExtents()[0]->getStart()->getValue()); + self::assertEquals('100', $parts[0]->getExtents()[0]->getEnd()->getValue()); + self::assertEquals(2, $parts[0]->getExtents()[0]->getTotal()); } public function testGetNoPartsByQueryForBookDocument() diff --git a/tests/resources/mods_book.xml b/tests/resources/mods_book.xml index 63dd3df..662fb22 100644 --- a/tests/resources/mods_book.xml +++ b/tests/resources/mods_book.xml @@ -148,14 +148,22 @@ 97 98 + 1989 + Some random text - + + Vagabonds + Vavava Gagaga Bonds + + Vagabonds + Vavava Gagaga Bonds 99 100 + 2 Bluegrass odyssey -- Hills of Tennessee -- Sassafrass -- Muddy river -- Take your shoes off Moses -- Let Smokey Mountain smoke get in your eyes -- Farewell party -- Faded love