diff --git a/tests/Mods/ModsReaderTest.php b/tests/Mods/ModsReaderTest.php index e368f55..62b3647 100644 --- a/tests/Mods/ModsReaderTest.php +++ b/tests/Mods/ModsReaderTest.php @@ -918,12 +918,26 @@ public function testGetTitleInfosForBookDocument() { $titleInfos = $this->bookReader->getTitleInfos(); self::assertNotEmpty($titleInfos); - self::assertEquals(1, count($titleInfos)); + self::assertEquals(2, count($titleInfos)); self::assertNotEmpty($titleInfos[0]->getValue()); - //self::assertNotEmpty($titleInfos[0]->getTitle()); - //self::assertNotEmpty($titleInfos[0]->getSubTitle()); + self::assertEquals('Sound and fury', $titleInfos[0]->getTitle()->getValue()); + self::assertEquals('the making of the punditocracy', $titleInfos[0]->getSubTitle()->getValue()); + } - // TODO: implement reading of elements + public function testGetTitleInfosByQueryForBookDocument() + { + $titleInfos = $this->bookReader->getTitleInfos('[@xml:lang="fr"]'); + self::assertNotEmpty($titleInfos); + self::assertEquals(1, count($titleInfos)); + self::assertNotEmpty($titleInfos[0]->getValue()); + self::assertNotEmpty($titleInfos[0]->getType()); + self::assertEquals('translated', $titleInfos[0]->getType()); + self::assertNotEmpty($titleInfos[0]->getNonSort()); + self::assertEquals('Le', $titleInfos[0]->getNonSort()->getValue()); + self::assertNotEmpty($titleInfos[0]->getTitle()); + self::assertEquals('bruit et la fureur', $titleInfos[0]->getTitle()->getValue()); + self::assertNotEmpty($titleInfos[0]->getSubTitle()); + self::assertEquals('la création de la punditocratie', $titleInfos[0]->getSubTitle()->getValue()); } public function testGetTitleInfosForSerialDocument() @@ -932,22 +946,21 @@ public function testGetTitleInfosForSerialDocument() self::assertNotEmpty($titleInfos); self::assertEquals(3, count($titleInfos)); self::assertNotEmpty($titleInfos[0]->getValue()); - //self::assertNotEmpty($titleInfos[0]->getTitle()); - //self::assertNotEmpty($titleInfos[0]->getSubTitle()); - - // TODO: implement reading of elements + self::assertNotEmpty($titleInfos[0]->getTitle()); + self::assertEquals('E-JASL', $titleInfos[0]->getTitle()->getValue()); + self::assertNotEmpty($titleInfos[0]->getSubTitle()); + self::assertEquals('the electronic journal of academic and special librarianship', $titleInfos[0]->getSubTitle()->getValue()); } public function testGetTitleInfosByQueryForSerialDocument() { - $titleInfos = $this->serialReader->getTitleInfos('[@type="alternative"]'); + $titleInfos = $this->serialReader->getTitleInfos('[@type="abbreviated"]'); self::assertNotEmpty($titleInfos); self::assertEquals(1, count($titleInfos)); self::assertNotEmpty($titleInfos[0]->getValue()); - //self::assertNotEmpty($titleInfos[0]->getTitle()); - //self::assertEmpty($titleInfos[0]->getSubTitle()); - - // TODO: implement reading of elements + self::assertEquals('E-JASL', $titleInfos[0]->getTitle()->getValue()); + self::assertNotEmpty($titleInfos[0]->getSubTitle()); + self::assertEquals('(Athabasca)', $titleInfos[0]->getSubTitle()->getValue()); } public function testGetNoTitleInfosByQueryForSerialDocument() diff --git a/tests/resources/mods_book.xml b/tests/resources/mods_book.xml index 77a97f9..4f49875 100644 --- a/tests/resources/mods_book.xml +++ b/tests/resources/mods_book.xml @@ -1,11 +1,16 @@ - Sound and fury the making of the punditocracy + + Le + bruit et la fureur + la création de la punditocratie + Alterman, Eric.