diff --git a/src/Mods/Element/Specific/Subject/HierarchicalGeographic.php b/src/Mods/Element/Specific/Subject/HierarchicalGeographic.php
index 0fa3b4f..3e77528 100644
--- a/src/Mods/Element/Specific/Subject/HierarchicalGeographic.php
+++ b/src/Mods/Element/Specific/Subject/HierarchicalGeographic.php
@@ -170,7 +170,7 @@ public function getTerritories(string $query = ''): array
public function getCounties(string $query = ''): array
{
$counties = [];
- $xpath = './mods:territory' . $query;
+ $xpath = './mods:county' . $query;
$element = new Element($this->xml, $xpath);
if ($element->exists()) {
foreach ($element->getValues() as $value) {
@@ -193,7 +193,7 @@ public function getCounties(string $query = ''): array
public function getCities(string $query = ''): array
{
$cities = [];
- $xpath = './mods:territory' . $query;
+ $xpath = './mods:city' . $query;
$element = new Element($this->xml, $xpath);
if ($element->exists()) {
foreach ($element->getValues() as $value) {
@@ -216,7 +216,7 @@ public function getCities(string $query = ''): array
public function getCitySections(string $query = ''): array
{
$sections = [];
- $xpath = './mods:section' . $query;
+ $xpath = './mods:citySection' . $query;
$element = new Element($this->xml, $xpath);
if ($element->exists()) {
foreach ($element->getValues() as $value) {
@@ -239,7 +239,7 @@ public function getCitySections(string $query = ''): array
public function getIslands(string $query = ''): array
{
$islands = [];
- $xpath = './mods:territory' . $query;
+ $xpath = './mods:island' . $query;
$element = new Element($this->xml, $xpath);
if ($element->exists()) {
foreach ($element->getValues() as $value) {
diff --git a/tests/Mods/ModsReaderTest.php b/tests/Mods/ModsReaderTest.php
index 346f066..a7ba56c 100644
--- a/tests/Mods/ModsReaderTest.php
+++ b/tests/Mods/ModsReaderTest.php
@@ -931,12 +931,28 @@ public function testGetSubjectsForBookDocument()
{
$subjects = $this->bookReader->getSubjects();
self::assertNotEmpty($subjects);
- self::assertEquals(7, count($subjects));
+ self::assertEquals(8, count($subjects));
self::assertNotEmpty($subjects[0]->getValue());
- //self::assertNotEmpty($subjects[0]->getTopic());
- //self::assertNotEmpty($subjects[0]->getGeographic());
-
- // TODO: implement reading of elements
+ $hierarchicalGeographics = $subjects[0]->getHierarchicalGeographics();
+ self::assertNotEmpty($hierarchicalGeographics);
+ self::assertNotEmpty($hierarchicalGeographics[0]->getCountries());
+ self::assertEquals(2, count($hierarchicalGeographics[0]->getCountries()));
+ self::assertEquals(1, $hierarchicalGeographics[0]->getCountries()[0]->getLevel());
+ self::assertEquals('United Kingdom', $hierarchicalGeographics[0]->getCountries()[0]->getValue());
+ self::assertNotEmpty($hierarchicalGeographics[0]->getRegions());
+ self::assertEquals('North West', $hierarchicalGeographics[0]->getRegions()[0]->getValue());
+ self::assertNotEmpty($hierarchicalGeographics[0]->getCounties());
+ self::assertEquals('Cumbria', $hierarchicalGeographics[0]->getCounties()[0]->getValue());
+ self::assertNotEmpty($hierarchicalGeographics[0]->getCities());
+ self::assertEquals('Providence', $hierarchicalGeographics[0]->getCities()[0]->getValue());
+ self::assertNotEmpty($hierarchicalGeographics[0]->getCitySections());
+ self::assertEquals(2, count($hierarchicalGeographics[0]->getCitySections()));
+ self::assertEquals('neighborhood', $hierarchicalGeographics[0]->getCitySections()[0]->getType());
+ self::assertEquals(1, $hierarchicalGeographics[0]->getCitySections()[0]->getLevel());
+ self::assertEquals('East Side', $hierarchicalGeographics[0]->getCitySections()[0]->getValue());
+ self::assertNotEmpty($hierarchicalGeographics[0]->getAreas());
+ self::assertEquals('national park', $hierarchicalGeographics[0]->getAreas()[0]->getType());
+ self::assertEquals('Lake District', $hierarchicalGeographics[0]->getAreas()[0]->getValue());
}
public function testGetSubjectsByQueryForBookDocument()
@@ -944,11 +960,15 @@ public function testGetSubjectsByQueryForBookDocument()
$subjects = $this->bookReader->getSubjects('[./mods:topic="Mass media"]');
self::assertNotEmpty($subjects);
self::assertEquals(1, count($subjects));
+ self::assertNotEmpty($subjects[0]->getAuthority());
+ self::assertEquals('lcsh', $subjects[0]->getAuthority());
self::assertNotEmpty($subjects[0]->getValue());
- //self::assertNotEmpty($subjects[0]->getTopic());
- //self::assertNotEmpty($subjects[0]->getGeographic());
-
- // TODO: implement reading of elements
+ self::assertNotEmpty($subjects[0]->getTopics());
+ self::assertEquals(2, count($subjects[0]->getTopics()));
+ self::assertEquals('Political aspects', $subjects[0]->getTopics()[1]->getValue());
+ self::assertNotEmpty($subjects[0]->getGeographics());
+ self::assertEquals(1, count($subjects[0]->getGeographics()));
+ self::assertEquals('United States', $subjects[0]->getGeographics()[0]->getValue());
}
public function testGetNoSubjectsByQueryForBookDocument()
@@ -961,12 +981,15 @@ public function testGetSubjectsForSerialDocument()
{
$subjects = $this->serialReader->getSubjects();
self::assertNotEmpty($subjects);
- self::assertEquals(6, count($subjects));
+ self::assertEquals(7, count($subjects));
self::assertNotEmpty($subjects[0]->getValue());
- //self::assertNotEmpty($subjects[0]->getTopic());
- //self::assertNotEmpty($subjects[0]->getGenre());
+ self::assertNotEmpty($subjects[0]->getCartographics());
- // TODO: implement reading of elements
+ // TODO: implement reading of cartographics
+ /*self::assertNotEmpty($subjects[0]->getCartographics()[0]->getCoordinates());
+ self::assertEquals('', $subjects[0]->getCartographics()[0]->getCoordinates()[0]->getValue());
+ self::assertNotEmpty($subjects[0]->getCartographics()[0]->getScale());
+ self::assertNotEmpty($subjects[0]->getCartographics()[0]->getProjection());*/
}
public function testGetSubjectsByQueryForSerialDocument()
@@ -975,10 +998,10 @@ public function testGetSubjectsByQueryForSerialDocument()
self::assertNotEmpty($subjects);
self::assertEquals(1, count($subjects));
self::assertNotEmpty($subjects[0]->getValue());
- //self::assertNotEmpty($subjects[0]->getForm());
- //self::assertNotEmpty($subjects[0]->getGenre());
-
- // TODO: implement reading of elements
+ self::assertNotEmpty($subjects[0]->getTopics());
+ self::assertEquals('Web sites', $subjects[0]->getTopics()[0]->getValue());
+ self::assertNotEmpty($subjects[0]->getGenres());
+ self::assertEquals('Directories', $subjects[0]->getGenres()[0]->getValue());
}
public function testGetNoSubjectsByQueryForSerialDocument()
diff --git a/tests/resources/mods_book.xml b/tests/resources/mods_book.xml
index a656b47..c09a09a 100644
--- a/tests/resources/mods_book.xml
+++ b/tests/resources/mods_book.xml
@@ -78,6 +78,18 @@
Test description for document which contains display label.
Eric Alterman.
Includes bibliographical references (p. 291-312) and index.
+
+
+ United Kingdom
+ England
+ North West
+ Cumbria
+ Providence
+ East Side
+ Blackstone
+ Lake District
+
+
n-us---
diff --git a/tests/resources/mods_serial.xml b/tests/resources/mods_serial.xml
index 60ee312..e608c84 100644
--- a/tests/resources/mods_serial.xml
+++ b/tests/resources/mods_serial.xml
@@ -51,6 +51,13 @@
Latest issue consulted: V. 9 no. 1 (spring 2008) (viewed Sept. 5, 2008).
Mode of access: World Wide Web.
Electronic serial in HTML format.
+
+
+ E 72°--E 148°/N 13°--N 18°
+ 1:22,000,000
+ Conic proj
+
+
Academic libraries
Periodicals