Skip to content

Commit

Permalink
Tests added and variables moved outside function.
Browse files Browse the repository at this point in the history
  • Loading branch information
siiriylonen committed Nov 13, 2023
1 parent 3055484 commit 2412c38
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/RecordManager/Finna/Record/Lido.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ class Lido extends \RecordManager\Base\Record\Lido
*/
protected $descriptionTypesExcludedFromTitle = ['provenance', 'provenienssi'];

/**
* Location labels which should be included when getting location information.
*
* @var array
*/
protected $includedLocationLabels = ['prt', 'kiinteistötunnus'];

/**
* Location labels which should be excluded when getting location information.
*
Expand Down Expand Up @@ -493,9 +500,8 @@ protected function getPlaceIDElements(bool $allEvents = false): array
?? [] as $set
) {
foreach ($set->repositoryLocation->placeID ?? [] as $placeID) {
$types = ['prt', 'kiinteistötunnus'];
$attr = $placeID->attributes();
if (in_array($attr->type, $types)) {
if (in_array($attr->type, $this->includedLocationLabels)) {
$result[] = $placeID;
}
if ($attr->type == 'URI' && $attr->source == 'YSO') {
Expand Down
21 changes: 17 additions & 4 deletions tests/RecordManagerTest/Finna/Record/LidoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,22 @@ public function testMusketti2()
'geographic_facet' => [
'Ruokolahti',
'Imatrankoski, Ruokolahti',
'Location, Location, Location',
'Repository Location 1',
'Repository Location 2',
'Imatrankoski',
'Ruokolahti',
],
'geographic' => [
'Ruokolahti',
'Imatrankoski, Ruokolahti',
'Location, Location, Location',
'Repository Location 1',
'Repository Location 2',
],
'geographic_id_str_mv' => [
'(prt)Prt',
'(kiinteistötunnus)Kiinteistötunnus',
'(URI)Uri and Yso',
],
'geographic_id_str_mv' => [],
'collection' => 'Kansatieteen kuvakokoelma',
'thumbnail' => 'http://muisti.nba.fi/m/4878_1/00013199.jpg',
'allfields' => [
Expand All @@ -187,7 +193,11 @@ public function testMusketti2()
'33,1. Imatra.',
'Museoviraston kuva-arkisto/',
'4878:1',
'Location, Location, Location',
'Repository Location 1',
'Repository Location 2',
'Prt',
'Kiinteistötunnus',
'Uri and Yso',
'valmistus',
'Hintze Harry',
'1897',
Expand Down Expand Up @@ -278,6 +288,9 @@ public function testMusketti2()
],
'identifier_txtP_mv' => [
'4878:1',
'Prt',
'Kiinteistötunnus',
'Uri and Yso',
],
];

Expand Down
8 changes: 7 additions & 1 deletion tests/fixtures/Finna/record/musketti2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@
<repositorySet>
<repositoryLocation>
<namePlaceSet>
<appellationValue>Location, Location, Location</appellationValue>
<appellationValue>Repository Location 1</appellationValue>
</namePlaceSet>
<namePlaceSet>
<appellationValue>Repository Location 2</appellationValue>
</namePlaceSet>
<placeID type="prt" source="YSO">Prt</placeID>
<placeID type="kiinteist&#xF6;tunnus" source="Kiinteist&#xF6;rekisteri">Kiinteistötunnus</placeID>
<placeID type="URI" source="YSO">Uri and Yso</placeID>
</repositoryLocation>
</repositorySet>
</repositoryWrap>
Expand Down

0 comments on commit 2412c38

Please sign in to comment.