Skip to content

Commit

Permalink
Variable arrays defined in subclass and tests moved as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
siiriylonen committed Apr 5, 2024
1 parent b6a7a18 commit 3fc7f2c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 55 deletions.
17 changes: 10 additions & 7 deletions src/RecordManager/Base/Record/Lido.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ class Lido extends AbstractRecord
protected $subjectConceptIDTypes = ['uri', 'url'];

/**
* Repository location types to be filtered.
* Repository location types to be included.
*
* @var array
*/
protected $repositoryLocationTypes = ['Current location'];
protected $repositoryLocationTypes = [];

/**
* Excluded appellationValue labels.
* Excluded location appellationValue labels.
*
* @var array
*/
protected $excludedAppellationValueLabels = ['tarkempi paikka'];
protected $excludedLocationAppellationValueLabels = [];

/**
* Return record ID (local)
Expand Down Expand Up @@ -1335,14 +1335,14 @@ protected function getRepositoryLocations(): array
?? [] as $set
) {
$type = (string)($set->attributes()->type ?? '');
if (!in_array($type, $this->repositoryLocationTypes)) {
if (!empty($this->repositoryLocationTypes) && !in_array($type, $this->repositoryLocationTypes)) {
continue;
}
foreach ($set->repositoryLocation->namePlaceSet ?? [] as $nameSet) {
foreach ($nameSet->appellationValue ?? [] as $place) {
if (
$place
&& !in_array((string)$place->attributes()->label, $this->excludedAppellationValueLabels)
&& !in_array((string)$place->attributes()->label, $this->excludedLocationAppellationValueLabels)
) {
$result[] = trim((string)$place);
}
Expand All @@ -1353,7 +1353,10 @@ protected function getRepositoryLocations(): array
while ($part->namePlaceSet ?? false) {
if ($partName = $part->namePlaceSet->appellationValue ?? '') {
if (
!in_array((string)$partName->attributes()->label, $this->excludedAppellationValueLabels)
!in_array(
(string)$partName->attributes()->label,
$this->excludedLocationAppellationValueLabels
)
) {
$result[] = trim((string)$partName);
}
Expand Down
32 changes: 4 additions & 28 deletions tests/RecordManagerTest/Base/Record/LidoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,8 @@ public function testLido1()
'ulkoilu',
],
'material_str_mv' => [],
'geographic_facet' => [
'Kalasatama',
'Capellanranta 1 ja 3 välillä',
'Helsinki',
],
'geographic' => [
'Kalasatama',
'Capellanranta 1 ja 3 välillä',
'Helsinki',
],
'geographic_facet' => [],
'geographic' => [],
'era' => [],
'era_facet' => [],
'collection' => '',
Expand All @@ -116,10 +108,6 @@ public function testLido1()
'9789518593731',
'9789518593732',
'0357-5284',
'Tarkempi paikka veden äärellä',
'Kalasatama',
'Capellanranta 1 ja 3 välillä',
'Helsinki',
'retkeily',
'ulkoilu',
'Luhtanen, Raimo',
Expand Down Expand Up @@ -208,16 +196,8 @@ public function testLido1NonMergedTitle()
'ulkoilu',
],
'material_str_mv' => [],
'geographic_facet' => [
'Kalasatama',
'Capellanranta 1 ja 3 välillä',
'Helsinki',
],
'geographic' => [
'Kalasatama',
'Capellanranta 1 ja 3 välillä',
'Helsinki',
],
'geographic_facet' => [],
'geographic' => [],
'era' => [],
'era_facet' => [],
'collection' => '',
Expand All @@ -243,10 +223,6 @@ public function testLido1NonMergedTitle()
'9789518593731',
'9789518593732',
'0357-5284',
'Tarkempi paikka veden äärellä',
'Kalasatama',
'Capellanranta 1 ja 3 välillä',
'Helsinki',
'retkeily',
'ulkoilu',
'Luhtanen, Raimo',
Expand Down
20 changes: 0 additions & 20 deletions tests/fixtures/Base/record/lido1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,6 @@
<repositorySet>
<workID type="issn">0357-5284</workID>
</repositorySet>
<repositorySet type="Current location">
<repositoryLocation>
<namePlaceSet>
<appellationValue label="tarkempi paikka">Tarkempi paikka veden &#xE4;&#xE4;rell&#xE4;</appellationValue>
</namePlaceSet>
<namePlaceSet>
<appellationValue>Kalasatama</appellationValue>
</namePlaceSet>
<partOfPlace>
<namePlaceSet>
<appellationValue label="katuosoite">Capellanranta 1 ja 3 v&#xE4;lill&#xE4;</appellationValue>
</namePlaceSet>
<partOfPlace>
<namePlaceSet>
<appellationValue label="kunta/kaupunki">Helsinki</appellationValue>
</namePlaceSet>
</partOfPlace>
</partOfPlace>
</repositoryLocation>
</repositorySet>
</repositoryWrap>
</objectIdentificationWrap>
<objectRelationWrap>
Expand Down

0 comments on commit 3fc7f2c

Please sign in to comment.