diff --git a/src/Mods/Element/Common/BaseElement.php b/src/Mods/Element/Common/BaseElement.php
index ece9ec7..c20b795 100644
--- a/src/Mods/Element/Common/BaseElement.php
+++ b/src/Mods/Element/Common/BaseElement.php
@@ -12,6 +12,8 @@
namespace Slub\Mods\Element\Common;
+use Slub\Mods\Element\Xml\Element;
+
/**
* MODS metadata element class for the 'php-mods-reader' library.
*
@@ -55,7 +57,7 @@ public function getValue(): string
/**
* Get the string value of attribute.
*
- * @access public
+ * @access protected
*
* @param string $attribute name
*
@@ -76,7 +78,7 @@ protected function getStringAttribute($attribute): string
/**
* Get the int value of attribute.
*
- * @access public
+ * @access protected
*
* @param string $attribute name
*
@@ -93,4 +95,85 @@ protected function getIntAttribute($attribute): int
}
return 0;
}
-}
\ No newline at end of file
+
+ /**
+ * Get the array of the matching elements.
+ *
+ * @access protected
+ *
+ * @param string $xpath The XPath for metadata search
+ *
+ * @return AuthorityLanguageElement[]
+ */
+ protected function getAuthorityLanguageElements(string $xpath): array
+ {
+ $elements = [];
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $elements[] = new AuthorityLanguageElement($value);
+ }
+ }
+ return $elements;
+ }
+
+ /**
+ * Get the the array of the matching elements.
+ *
+ * @access protected
+ *
+ * @param string $xpath The XPath for metadata search
+ *
+ * @return DateElement[]
+ */
+ protected function getDateElements(string $xpath): array
+ {
+ $elements = [];
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $elements[] = new DateElement($value);
+ }
+ }
+ return $elements;
+ }
+
+ /**
+ * Get the matching element or null if there is not match.
+ *
+ * @access protected
+ *
+ * @param string $xpath The XPath for metadata search
+ *
+ * @return ?LanguageElement
+ */
+ protected function getLanguageElement(string $xpath): ?LanguageElement
+ {
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ return new LanguageElement($element->getValues()[0]);
+ }
+ return null;
+ }
+
+ /**
+ * Get the array of the matching elements.
+ *
+ * @access protected
+ *
+ * @param string $xpath The XPath for metadata search
+ *
+ * @return LanguageElement[]
+ */
+ protected function getLanguageElements(string $xpath): array
+ {
+ $elements = [];
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $elements[] = new LanguageElement($value);
+ }
+ }
+ return $elements;
+ }
+}
diff --git a/src/Mods/Element/OriginInfo.php b/src/Mods/Element/OriginInfo.php
index d4b285a..0ea781f 100644
--- a/src/Mods/Element/OriginInfo.php
+++ b/src/Mods/Element/OriginInfo.php
@@ -24,9 +24,12 @@
use Slub\Mods\Element\Specific\OriginInfo\Edition;
use Slub\Mods\Element\Specific\OriginInfo\Frequency;
use Slub\Mods\Element\Specific\OriginInfo\Issuance;
+use Slub\Mods\Element\Specific\OriginInfo\Place;
+use Slub\Mods\Element\Xml\Element;
/**
* OriginInfo MODS metadata element class for the 'php-mods-reader' library.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html
*
* @access public
*/
@@ -34,84 +37,6 @@ class OriginInfo extends BaseElement
{
use LanguageAttribute, IdAttribute, AltRepGroupAttribute, DisplayLabelAttribute;
- /**
- * @access private
- * @var array
- */
- private array $places;
-
- /**
- * @access private
- * @var Agent
- */
- private Agent $agent;
-
- /**
- * @access private
- * @var DateElement
- */
- private DateElement $dateIssued;
-
- /**
- * @access private
- * @var DateElement
- */
- private DateElement $dateCreated;
-
- /**
- * @access private
- * @var DateElement
- */
- private DateElement $dateCaptured;
-
- /**
- * @access private
- * @var DateElement
- */
- private DateElement $dateValid;
-
- /**
- * @access private
- * @var DateElement
- */
- private DateElement $dateModified;
-
- /**
- * @access private
- * @var DateElement
- */
- private DateElement $copyrightDate;
-
- /**
- * @access private
- * @var DateOther
- */
- private DateOther $dateOther;
-
- /**
- * @access private
- * @var DisplayDate
- */
- private DisplayDate $displayDate;
-
- /**
- * @access private
- * @var Edition
- */
- private Edition $edition;
-
- /**
- * @access private
- * @var Issuance
- */
- private Issuance $issuance;
-
- /**
- * @access private
- * @var Frequency
- */
- private Frequency $frequency;
-
/**
* This extracts the essential MODS metadata from XML
*
@@ -124,24 +49,11 @@ class OriginInfo extends BaseElement
public function __construct(\SimpleXMLElement $xml)
{
parent::__construct($xml);
-
- $this->places = [];
- $this->agent = new Agent($xml);
- $this->dateIssued = new DateElement($xml);
- $this->dateCreated = new DateElement($xml);
- $this->dateCaptured = new DateElement($xml);
- $this->dateValid = new DateElement($xml);
- $this->dateModified = new DateElement($xml);
- $this->copyrightDate = new DateElement($xml);
- $this->dateOther = new DateOther($xml);
- $this->displayDate = new DisplayDate($xml);
- $this->edition = new Edition($xml);
- $this->issuance = new Issuance($xml);
- $this->frequency = new Frequency($xml);
}
/**
- * Get the value of eventType
+ * Get the value of the 'eventType' attribute.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#eventType
*
* @access public
*
@@ -153,7 +65,8 @@ public function getEventType(): string
}
/**
- * Get the value of eventTypeURI
+ * Get the value of the 'eventTypeURI' attribute.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#eventTypeURI
*
* @access public
*
@@ -165,158 +78,253 @@ public function getEventTypeURI(): string
}
/**
- * Get the value of places
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#place
*
* @access public
*
- * @return array
+ * @param string $query The XPath query for metadata search
+ *
+ * @return Place[]
*/
- public function getPlaces(): array
+ public function getPlaces(string $query = ''): array
{
- return $this->places;
+ $places = [];
+ $xpath = './mods:place' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $places[] = new Place($value);
+ }
+ }
+ return $places;
}
/**
- * Get the value of agent
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#agent
*
* @access public
*
- * @return Agent
+ * @param string $query The XPath query for metadata search
+ *
+ * @return Agent[]
*/
- public function getAgent(): Agent
+ public function getAgents(string $query = ''): array
{
- return $this->agent;
+ $agents = [];
+ $xpath = './mods:agent' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $agents[] = new Agent($value);
+ }
+ }
+ return $agents;
}
/**
- * Get the value of dateIssued
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#dateissued
*
* @access public
*
- * @return DateElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return DateElement[]
*/
- public function getDateIssued(): DateElement
+ public function getIssuedDates(string $query = ''): array
{
- return $this->dateIssued;
+ return $this->getDateElements('./mods:dateIssued' . $query);
}
/**
- * Get the value of dateCreated
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#datecreated
*
* @access public
*
- * @return DateElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return DateElement[]
*/
- public function getDateCreated(): DateElement
+ public function getCreatedDates(string $query = ''): array
{
- return $this->dateCreated;
+ return $this->getDateElements('./mods:dateCreated' . $query);
}
/**
- * Get the value of dateCaptured
+ * Get the the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#datecaptured
*
* @access public
*
- * @return DateElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return DateElement[]
*/
- public function getDateCaptured(): DateElement
+ public function getCapturedDates(string $query = ''): array
{
- return $this->dateCaptured;
+ return $this->getDateElements('./mods:dateCaptured' . $query);
}
/**
- * Get the value of dateValid
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#datevalid
*
* @access public
*
- * @return DateElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return DateElement[]
*/
- public function getDateValid(): DateElement
+ public function getValidDates(string $query = ''): array
{
- return $this->dateValid;
+ return $this->getDateElements('./mods:dateValid' . $query);
}
/**
- * Get the value of dateModified
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#datemodified
*
* @access public
*
- * @return DateElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return DateElement[]
*/
- public function getDateModified(): DateElement
+ public function getModifiedDates(string $query = ''): array
{
- return $this->dateModified;
+ return $this->getDateElements('./mods:dateModified' . $query);
}
/**
- * Get the value of copyrightDate
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#copyrightdate
*
* @access public
*
- * @return DateElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return DateElement[]
*/
- public function getCopyrightDate(): DateElement
+ public function getCopyrightDates(string $query = ''): array
{
- return $this->copyrightDate;
+ return $this->getDateElements('./mods:copyrightDate' . $query);
}
/**
- * Get the value of dateOther
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#dateother
*
* @access public
*
- * @return DateOther
+ * @param string $query The XPath query for metadata search
+ *
+ * @return DateOther[]
*/
- public function getDateOther(): DateOther
+ public function getOtherDates(string $query = ''): array
{
- return $this->dateOther;
+ $otherDates = [];
+ $xpath = './mods:dateOther' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $otherDates[] = new DateOther($value);
+ }
+ }
+ return $otherDates;
}
/**
- * Get the value of displayDate
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#displayDate
*
* @access public
*
- * @return DisplayDate
+ * @param string $query The XPath query for metadata search
+ *
+ * @return DisplayDate[]
*/
- public function getDisplayDate(): DisplayDate
+ public function getDisplayDates(string $query = ''): array
{
- return $this->displayDate;
+ $displayDates = [];
+ $xpath = './mods:displayDate' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $displayDates[] = new DisplayDate($value);
+ }
+ }
+ return $displayDates;
}
/**
- * Get the value of edition
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#edition
*
* @access public
*
- * @return Edition
+ * @param string $query The XPath query for metadata search
+ *
+ * @return Edition[]
*/
- public function getEdition(): Edition
+ public function getEditions(string $query = ''): array
{
- return $this->edition;
+ $editions = [];
+ $xpath = './mods:edition' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $editions[] = new Edition($value);
+ }
+ }
+ return $editions;
}
/**
- * Get the value of issuance
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#issuance
*
* @access public
*
- * @return Issuance
+ * @param string $query The XPath query for metadata search
+ *
+ * @return Issuance[]
*/
- public function getIssuance(): Issuance
+ public function getIssuances(string $query = ''): array
{
- return $this->issuance;
+ $issuances = [];
+ $xpath = './mods:issuance' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $issuances[] = new Issuance($value);
+ }
+ }
+ return $issuances;
}
/**
- * Get the value of frequency
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#frequency
*
* @access public
*
- * @return Frequency
+ * @param string $query The XPath query for metadata search
+ *
+ * @return Frequency[]
*/
- public function getFrequency(): Frequency
+ public function getFrequencies(string $query = ''): array
{
- return $this->frequency;
+ $frequencies = [];
+ $xpath = './mods:frequency' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $frequencies[] = new Frequency($value);
+ }
+ }
+ return $frequencies;
}
}
diff --git a/src/Mods/Element/RecordInfo.php b/src/Mods/Element/RecordInfo.php
index f5c481e..fdd1cb9 100644
--- a/src/Mods/Element/RecordInfo.php
+++ b/src/Mods/Element/RecordInfo.php
@@ -36,12 +36,6 @@ class RecordInfo extends BaseElement
{
use LanguageAttribute, IdAttribute, AltRepGroupAttribute, DisplayLabelAttribute, UsageAttribute;
- /**
- * @access private
- * @var AuthorityLanguageElement
- */
- private AuthorityLanguageElement $descriptionStandard;
-
/**
* This extracts the essential MODS metadata from XML
*
@@ -148,14 +142,14 @@ public function getRecordOrigins(string $query = ''): array
}
/**
- * Get the array of the elements.
- * @see https://www.loc.gov/standards/mods/userguide/recordinfo.html#recordidentifier
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/recordinfo.html#recordinfonote
*
* @access public
*
* @param string $query The XPath query for metadata search
*
- * @return RecordIdentifier[]
+ * @return RecordInfoNote[]
*/
public function getRecordInfoNotes(string $query = ''): array
{
@@ -207,46 +201,4 @@ public function getDescriptionStandards(string $query = ''): array
{
return $this->getAuthorityLanguageElements('./mods:descriptionStandard' . $query);
}
-
- /**
- * Get the array of the matching elements.
- *
- * @access public
- *
- * @param string $xpath The XPath for metadata search
- *
- * @return AuthorityLanguageElement[]
- */
- private function getAuthorityLanguageElements(string $xpath): array
- {
- $elements = [];
- $element = new Element($this->xml, $xpath);
- if ($element->exists()) {
- foreach ($element->getValues() as $value) {
- $elements[] = new AuthorityLanguageElement($value);
- }
- }
- return $elements;
- }
-
- /**
- * Get the array of the matching elements.
- *
- * @access public
- *
- * @param string $xpath The XPath for metadata search
- *
- * @return DateElement[]
- */
- private function getDateElements(string $xpath): array
- {
- $elements = [];
- $element = new Element($this->xml, $xpath);
- if ($element->exists()) {
- foreach ($element->getValues() as $value) {
- $elements[] = new DateElement($value);
- }
- }
- return $elements;
- }
}
diff --git a/src/Mods/Element/Specific/OriginInfo/Place.php b/src/Mods/Element/Specific/OriginInfo/Place.php
index bfb0f3f..7767724 100644
--- a/src/Mods/Element/Specific/OriginInfo/Place.php
+++ b/src/Mods/Element/Specific/OriginInfo/Place.php
@@ -15,10 +15,12 @@
use Slub\Mods\Attribute\Common\Miscellaneous\SuppliedAttribute;
use Slub\Mods\Element\Common\BaseElement;
use Slub\Mods\Element\Specific\OriginInfo\Place\Cartographics;
-use Slub\Mods\Element\Specific\OriginInfo\Place\PlaceIdentifier;
+use Slub\Mods\Element\Specific\OriginInfo\Place\PlaceTerm;
+use Slub\Mods\Element\Xml\Element;
/**
* Place MODS metadata element class for the 'php-mods-reader' library.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#place
*
* @access public
*/
@@ -26,24 +28,6 @@ class Place extends BaseElement
{
use SuppliedAttribute;
- /**
- * @access private
- * @var array
- */
- private array $placeTerms;
-
- /**
- * @access private
- * @var PlaceIdentifier
- */
- private PlaceIdentifier $placeIdentifier;
-
- /**
- * @access private
- * @var Cartographics
- */
- private Cartographics $cartographics;
-
/**
* This extracts the essential MODS metadata from XML
*
@@ -59,38 +43,71 @@ public function __construct(\SimpleXMLElement $xml)
}
/**
- * Get the value of placeTerms
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#placeterm
*
* @access public
*
- * @return array
+ * @param string $query The XPath query for metadata search
+ *
+ * @return PlaceTerm[]
*/
- public function getPlaceTerms(): array
+ public function getPlaceTerms(string $query = ''): array
{
- return $this->placeTerms;
+ $placeTerms = [];
+ $xpath = './mods:placeTerm' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $placeTerms[] = new PlaceTerm($value);
+ }
+ }
+ return $placeTerms;
}
/**
- * Get the value of placeIdentifier
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#placeidentifier
*
* @access public
*
- * @return PlaceIdentifier
+ * @param string $query The XPath query for metadata search
+ *
+ * @return BaseElement[]
*/
- public function getPlaceIdentifier(): PlaceIdentifier
+ public function getPlaceIdentifiers(string $query = ''): array
{
- return $this->placeIdentifier;
+ $placeIdentifiers = [];
+ $xpath = './mods:placeIdentifier' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $placeIdentifiers[] = new BaseElement($value);
+ }
+ }
+ return $placeIdentifiers;
}
/**
- * Get the value of cartographics
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#oiplacecartographics
*
* @access public
*
- * @return Cartographics
+ * @param string $query The XPath query for metadata search
+ *
+ * @return Cartographics[]
*/
- public function getCartographics(): Cartographics
+ public function getCartographics(string $query = ''): array
{
- return $this->cartographics;
+ $cartographics = [];
+ $xpath = './mods:cartographics' . $query;
+ $element = new Element($this->xml, $xpath);
+ if ($element->exists()) {
+ foreach ($element->getValues() as $value) {
+ $cartographics[] = new Cartographics($value);
+ }
+ }
+ return $cartographics;
}
}
diff --git a/src/Mods/Element/Specific/OriginInfo/Place/Cartographics.php b/src/Mods/Element/Specific/OriginInfo/Place/Cartographics.php
index 29484fc..c24ee37 100644
--- a/src/Mods/Element/Specific/OriginInfo/Place/Cartographics.php
+++ b/src/Mods/Element/Specific/OriginInfo/Place/Cartographics.php
@@ -18,6 +18,7 @@
/**
* Cartographics MODS metadata element class for the 'php-mods-reader' library.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#oiplacecartographics
*
* @access public
*/
@@ -25,30 +26,6 @@ class Cartographics extends BaseElement
{
use AuthorityAttribute;
- /**
- * @access private
- * @var array
- */
- private array $coordinates;
-
- /**
- * @access private
- * @var LanguageElement
- */
- private LanguageElement $projection;
-
- /**
- * @access private
- * @var LanguageElement
- */
- private LanguageElement $scale;
-
- /**
- * @access private
- * @var LanguageElement
- */
- private LanguageElement $cartographicExtension;
-
/**
* This extracts the essential MODS metadata from XML
*
@@ -61,57 +38,63 @@ class Cartographics extends BaseElement
public function __construct(\SimpleXMLElement $xml)
{
parent::__construct($xml);
-
- $this->projection = new LanguageElement($xml);
- $this->scale = new LanguageElement($xml);
- $this->cartographicExtension = new LanguageElement($xml);
}
/**
- * Get the value of coordinates
+ * Get the value of the element.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#projection
*
* @access public
*
- * @return array
+ * @return ?LanguageElement
*/
- public function getCoordinates(): array
+ public function getProjection(string $query = ''): ?LanguageElement
{
- return $this->coordinates;
+ return $this->getLanguageElement('./mods:projection' . $query);
}
/**
- * Get the value of projection
+ * Get the value of the element.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#scale
*
* @access public
*
- * @return LanguageElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return ?LanguageElement
*/
- public function getProjection(): LanguageElement
+ public function getScale(string $query = ''): ?LanguageElement
{
- return $this->projection;
+ return $this->getLanguageElement('./mods:scale' . $query);
}
/**
- * Get the value of scale
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#coordinates
*
* @access public
*
- * @return LanguageElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return LanguageElement[]
*/
- public function getScale(): LanguageElement
+ public function getCoordinates(string $query = ''): array
{
- return $this->scale;
+ return $this->getLanguageElements('./mods:coordinates' . $query);
}
/**
- * Get the value of cartographicExtension
+ * Get the array of the elements.
+ * @see https://www.loc.gov/standards/mods/userguide/origininfo.html#cartographicextension
*
* @access public
*
- * @return LanguageElement
+ * @param string $query The XPath query for metadata search
+ *
+ * @return LanguageElement[]
*/
- public function getCartographicExtension(): LanguageElement
+ public function getCartographicExtensions(string $query = ''): array
{
- return $this->cartographicExtension;
+ return $this->getLanguageElements('./mods:cartographicExtension' . $query);
}
-}
\ No newline at end of file
+}
diff --git a/src/Mods/Element/Specific/OriginInfo/Place/PlaceIdentifier.php b/src/Mods/Element/Specific/OriginInfo/Place/PlaceIdentifier.php
deleted file mode 100644
index 656a46a..0000000
--- a/src/Mods/Element/Specific/OriginInfo/Place/PlaceIdentifier.php
+++ /dev/null
@@ -1,38 +0,0 @@
-getValue());
self::assertNotEmpty($originInfos[0]->getEventType());
self::assertEquals('publication', $originInfos[0]->getEventType());
-
- // TODO: implement reading of elements
+ self::assertNotEmpty($originInfos[0]->getPlaces());
+ self::assertEquals(2, count($originInfos[0]->getPlaces()));
+ $placeTerms = $originInfos[0]->getPlaces()[0]->getPlaceTerms();
+ self::assertNotEmpty($placeTerms);
+ self::assertEquals('marccountry', $placeTerms[0]->getAuthority());
+ self::assertEquals('code', $placeTerms[0]->getType());
+ self::assertEquals('nyu', $placeTerms[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getIssuedDates());
+ self::assertEquals(2, count($originInfos[0]->getIssuedDates()));
+ self::assertEquals('marc', $originInfos[0]->getIssuedDates()[0]->getEncoding());
+ self::assertEquals('2000', $originInfos[0]->getIssuedDates()[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getIssuances());
+ self::assertEquals('monographic', $originInfos[0]->getIssuances()[0]->getValue());
}
public function testGetOriginInfosByQueryForBookDocument()
@@ -683,8 +694,17 @@ public function testGetOriginInfosByQueryForBookDocument()
self::assertNotEmpty($originInfos[0]->getValue());
self::assertNotEmpty($originInfos[0]->getEventType());
self::assertEquals('redaction', $originInfos[0]->getEventType());
-
- // TODO: implement reading of elements
+ self::assertNotEmpty($originInfos[0]->getPlaces());
+ self::assertEquals(2, count($originInfos[0]->getPlaces()));
+ $placeTerms = $originInfos[0]->getPlaces()[1]->getPlaceTerms();
+ self::assertNotEmpty($placeTerms);
+ self::assertEquals('text', $placeTerms[0]->getType());
+ self::assertEquals('Ithaca, N.Y', $placeTerms[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getIssuedDates());
+ self::assertEquals(2, count($originInfos[0]->getIssuedDates()));
+ self::assertEquals('marc', $originInfos[0]->getIssuedDates()[0]->getEncoding());
+ self::assertEquals('1999', $originInfos[0]->getIssuedDates()[0]->getValue());
+ self::assertEmpty($originInfos[0]->getIssuances());
}
public function testGetNoOriginInfosByQueryForBookDocument()
@@ -701,8 +721,25 @@ public function testGetOriginInfosForSerialDocument()
self::assertNotEmpty($originInfos[0]->getValue());
self::assertNotEmpty($originInfos[0]->getEventType());
self::assertEquals('publication', $originInfos[0]->getEventType());
-
- // TODO: implement reading of elements
+ self::assertNotEmpty($originInfos[0]->getPlaces());
+ self::assertEquals(2, count($originInfos[0]->getPlaces()));
+ $placeTerms = $originInfos[0]->getPlaces()[0]->getPlaceTerms();
+ self::assertNotEmpty($placeTerms);
+ self::assertEquals('marccountry', $placeTerms[0]->getAuthority());
+ self::assertEquals('code', $placeTerms[0]->getType());
+ self::assertEquals('abc', $placeTerms[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getIssuedDates());
+ self::assertEquals(3, count($originInfos[0]->getIssuedDates()));
+ self::assertEquals('marc', $originInfos[0]->getIssuedDates()[0]->getEncoding());
+ self::assertEquals('start', $originInfos[0]->getIssuedDates()[0]->getPoint());
+ self::assertEquals('2002', $originInfos[0]->getIssuedDates()[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getIssuances());
+ self::assertEquals('serial', $originInfos[0]->getIssuances()[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getFrequencies());
+ self::assertEquals(2, count($originInfos[0]->getFrequencies()));
+ self::assertEquals('Three times a year', $originInfos[0]->getFrequencies()[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getAgents());
+ //self::assertNotEmpty($originInfos[0]->getAgents()[0]->getNamePart());
}
public function testGetOriginInfosByQueryForSerialDocument()
@@ -713,8 +750,25 @@ public function testGetOriginInfosByQueryForSerialDocument()
self::assertNotEmpty($originInfos[0]->getValue());
self::assertNotEmpty($originInfos[0]->getEventType());
self::assertEquals('publication', $originInfos[0]->getEventType());
-
- // TODO: implement reading of elements
+ self::assertNotEmpty($originInfos[0]->getPlaces());
+ self::assertEquals(2, count($originInfos[0]->getPlaces()));
+ $placeTerms = $originInfos[0]->getPlaces()[0]->getPlaceTerms();
+ self::assertNotEmpty($placeTerms);
+ self::assertEquals('marccountry', $placeTerms[0]->getAuthority());
+ self::assertEquals('code', $placeTerms[0]->getType());
+ self::assertEquals('abc', $placeTerms[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getIssuedDates());
+ self::assertEquals(3, count($originInfos[0]->getIssuedDates()));
+ self::assertEquals('marc', $originInfos[0]->getIssuedDates()[0]->getEncoding());
+ self::assertEquals('start', $originInfos[0]->getIssuedDates()[0]->getPoint());
+ self::assertEquals('2002', $originInfos[0]->getIssuedDates()[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getIssuances());
+ self::assertEquals('serial', $originInfos[0]->getIssuances()[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getFrequencies());
+ self::assertEquals(2, count($originInfos[0]->getFrequencies()));
+ self::assertEquals('Three times a year', $originInfos[0]->getFrequencies()[0]->getValue());
+ self::assertNotEmpty($originInfos[0]->getAgents());
+ //self::assertNotEmpty($originInfos[0]->getAgents()[0]->getNamePart());
}
public function testGetNoOriginInfosByQueryForSerialDocument()
diff --git a/tests/resources/mods_book.xml b/tests/resources/mods_book.xml
index bf3a591..63dd3df 100644
--- a/tests/resources/mods_book.xml
+++ b/tests/resources/mods_book.xml
@@ -52,7 +52,6 @@
nyu
1999
- monographic
Ithaca, N.Y