Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 162 additions & 0 deletions tests/RecordManagerTest/Base/Record/EadTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?php

/**
* EAD Record Driver Test Class
*
* PHP version 5
*
* Copyright (C) The National Library of Finland 2026.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category DataManagement
* @package RecordManager
* @author Minna Rönkä <minna.ronka@helsinki.fi>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://github.com/NatLibFi/RecordManager
*/

namespace RecordManagerTest\Base\Record;

use RecordManager\Base\Record\Ead;

/**
* EAD3 Record Driver Test Class
*
* @category DataManagement
* @package RecordManager
* @author Minna Rönkä <minna.ronka@helsinki.fi>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://github.com/NatLibFi/RecordManager
*/
class EadTest extends RecordTestBase
{
/**
* Test EAD record handling
*
* @return void
*/
public function testEad1()
{
$record = $this->createRecord(
Ead::class,
'ead1.xml',
[
'__unit_test_no_source__' => [
'driverParams' => [
'addIdToHierarchyTitle=false',
],
],
]
);
$fields = $record->toSolrArray();
unset($fields['fullrecord']);

$expected = [
'allfields' => [
'Suomi päivä "Finland Day" New Yorkin maailmannäyttelyssä.',
'USA_1287',
'1940',
'172 vedosta',
'Siirtolaisuusinstituutin arkisto. Hämeenkatu 13, 20500 Turku',
'fin',
'eng',
'Haapaniemi, Fred',
'1912-1966',
'Siirtolaisuusinstituutti',
'Sivu 1',
'Suomi päivä "Finland Day" New Yorkin maailmannäyttelyssä kesäkuussa 1940.',
'Image/Photo',
'Yhdysvallat',
'40.71278, -74.00611',
'New York (kaupunki)',
'muuttoliike',
'siirtolaisuus',
'siirtolaiset',
'ulkosuomalaiset',
'amerikansuomalaiset',
'tapahtumat',
'maailmannäyttelyt',
'CC BY 4.0',
'Haapaniemi, Fred (arkisto)',
'Haapaniemi, Fred (arkisto)',
],
'author' => [],
'author2' => [
'Haapaniemi, Fred',
],
'author_corporate' => [],
'author_sort' => '',
'ctrlnum' => [],
'description' => 'Suomi päivä "Finland Day" New Yorkin maailmannäyttelyssä kesäkuussa 1940.',
'format' => 'Image/Photo',
'geographic' => [
'Yhdysvallat',
'New York (kaupunki)',
],
'geographic_facet' => [
'Yhdysvallat',
'New York (kaupunki)',
],
'hierarchy_parent_id' => '239',
'hierarchy_parent_title' => 'Haapaniemi, Fred (arkisto)',
'hierarchy_sequence' => '0000003',
'hierarchy_top_id' => '239',
'hierarchy_top_title' => 'Haapaniemi, Fred (arkisto)',
'hierarchytype' => 'Default',
'institution' => 'Siirtolaisuusinstituutti',
'isbn' => [],
'issn' => [],
'language' => [
'fin',
'eng',
],
'long_lat' => 'POINT(-74.00611 40.71278)',
'physical' => [
'172 vedosta',
],
'publishDate' => [],
'publishDateRange' => [],
'publishDateSort' => '',
'record_format' => 'ead',
'series' => '',
'thumbnail' => '',
'title' => 'USA_1287 Suomi päivä "Finland Day" New Yorkin maailmannäyttelyssä.',
'title_full' => 'USA_1287 Suomi päivä "Finland Day" New Yorkin maailmannäyttelyssä.',
'title_short' => 'Suomi päivä "Finland Day" New Yorkin maailmannäyttelyssä.',
'title_sort' => 'suomi päivä finland day new yorkin maailmannäyttelyssä',
'title_sub' => 'USA_1287',
'topic' => [
'muuttoliike',
'siirtolaisuus',
'siirtolaiset',
'ulkosuomalaiset',
'amerikansuomalaiset',
'tapahtumat',
'maailmannäyttelyt',
],
'topic_facet' => [
'muuttoliike',
'siirtolaisuus',
'siirtolaiset',
'ulkosuomalaiset',
'amerikansuomalaiset',
'tapahtumat',
'maailmannäyttelyt',
],
];

$this->compareArray($expected, $fields, 'toSolrArray');
}
}
90 changes: 90 additions & 0 deletions tests/RecordManagerTest/Base/Record/ForwardAuthorityTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

/**
* ForwardAuthority Record Driver Test Class
*
* PHP version 5
*
* Copyright (C) The National Library of Finland 2026.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @category DataManagement
* @package RecordManager
* @author Minna Rönkä <minna.ronka@helsinki.fi>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://github.com/NatLibFi/RecordManager
*/

namespace RecordManagerTest\Base\Record;

use RecordManager\Base\Record\ForwardAuthority;

/**
* ForwardAuthority Record Driver Test Class
*
* @category DataManagement
* @package RecordManager
* @author Minna Rönkä <minna.ronka@helsinki.fi>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://github.com/NatLibFi/RecordManager
*/
class ForwardAuthorityTest extends RecordTestBase
{
/**
* Test ForwardAuthority record handling
*
* @return void
*/
public function testForwardAuthority1()
{
$record = $this->createRecord(
ForwardAuthority::class,
'forward_authority_1.xml',
);
$fields = $record->toSolrArray();
unset($fields['fullrecord']);

$expected = [
'allfields' => [
'Kookaburra_0026. Uusitalo: Jussien viisi vuosikymmentä. SKF 10. HS 6.12.2002. Emu_0027',
'Jussi-palkinnot 1951 parhaasta ohjauksesta sekä käsikirjoituksesta '
. '(yhdessä FrilledLizard_0028 kanssa) elokuvasta Radio tekee murron.',
'Cassowary_0019',
'Cassowary_0019',
],
'birth_date' => '1900',
'birth_place' => 'Keuruu',
'death_date' => '1901',
'death_place' => 'Vantaa',
'field_of_activity' => [],
'heading' => 'Cassowary_0019',
'language' => '',
'occupation' => [
'Dingo_0018',
],
'record_format' => 'forwardAuthority',
'record_type' => 'elonet_henkilo',
'related_place' => [
'Suomi',
],
'source' => '__unit_test_no_source__',
'use_for' => [
'Cassowary_0019',
],
];

$this->compareArray($expected, $fields, 'toSolrArray');
}
}
63 changes: 63 additions & 0 deletions tests/fixtures/Base/record/ead1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0"?>
<c level="item">
<did>
<unittitle>Suomi p&#xE4;iv&#xE4; "Finland Day" New Yorkin maailmann&#xE4;yttelyss&#xE4;.</unittitle>
<unitid identifier="m198">USA_1287</unitid>
<unitdate>1940</unitdate>
<physdesc>
<extent>172 vedosta</extent>
</physdesc>
<physloc>Siirtolaisuusinstituutin arkisto. H&#xE4;meenkatu 13, 20500 Turku</physloc>
<langmaterial>
<language>fin</language>
<language>eng</language>
</langmaterial>
<origination>
<persname>Haapaniemi, Fred</persname>
<ref>
<date>1912-1966</date>
</ref>
</origination>
<repository>
<corpname>Siirtolaisuusinstituutti</corpname>
</repository>
<daogrp>
<daodesc>
<p>Sivu 1</p>
</daodesc>
<daoloc linktype="locator" role="image_full" href="https://siiri2.utu.fi/content/USA_1287.jpg"/>
</daogrp>
</did>
<scopecontent>
<p>Suomi p&#xE4;iv&#xE4; "Finland Day" New Yorkin maailmann&#xE4;yttelyss&#xE4; kes&#xE4;kuussa 1940.</p>
</scopecontent>
<controlaccess/>
<controlaccess>
<genreform>Image/Photo</genreform>
</controlaccess>
<controlaccess>
<geogname>Yhdysvallat</geogname>
</controlaccess>
<controlaccess>
<geogname>
<geographiccoordinates coordinatesystem="WGS84">40.71278, -74.00611</geographiccoordinates>
<part>New York (kaupunki)</part>
</geogname>
</controlaccess>
<controlaccess>
<subject>muuttoliike</subject>
<subject>siirtolaisuus</subject>
<subject>siirtolaiset</subject>
<subject>ulkosuomalaiset</subject>
<subject>amerikansuomalaiset</subject>
<subject>tapahtumat</subject>
<subject>maailmann&#xE4;yttelyt</subject>
</controlaccess>
<userestrict>
<p>CC BY 4.0</p>
</userestrict>
<add-data identifier="239_m198">
<archive id="239" title="Haapaniemi, Fred (arkisto)" sequence="0000003"/>
<parent id="239" title="Haapaniemi, Fred (arkisto)"/>
</add-data>
</c>
14 changes: 2 additions & 12 deletions tests/fixtures/Base/record/forward_authority_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@
<PersonName>Goanna_0007</PersonName>
<PersonNameInverted>FairyPenguin_0058, Quokka_0020</PersonNameInverted>
</CAgentName>
<BiographicalNote henkilo-biografia-tyyppi="palkinnot">Jussi-palkinnot 1951 parhaasta ohjauksesta sek&#xE4; k&#xE4;sikirjoituksesta (yhdess&#xE4; FrilledLizard_0028 kanssa) elokuvasta Radio tekee murron.&#xD;
Jussi-palkinto 1954 parhaasta ohjauksesta elokuvassa Sininen viikko.&#xD;
Jussi-palkinto 1955 parhaasta ohjauksesta elokuvissa Is&#xE4;n vanha ja uusi sek&#xE4; Hilman p&#xE4;iv&#xE4;t.&#xD;
Jussi-palkinto 1957 parhaasta ohjauksesta elokuvassa Elokuu.&#xD;
Jussi-palkinto 1959 parhaasta k&#xE4;sikirjoituksesta elokuvassa Punainen viiva.&#xD;
Jussi-palkinto 1962 parhaasta k&#xE4;sikirjoituksesta (yhdess&#xE4; Wombat_0014 kanssa) elokuvassa Kaasua, komisario Palmu!.&#xD;
Ylim&#xE4;&#xE4;r&#xE4;inen valtionpalkinto 1987 (50 000 mk).&#xD;
BlueTongueSkink_0029 -mitali 1995.&#xD;
SeaDragon_0010&#xE4;n elokuvajuhlilla 2003 merkitt&#xE4;v&#xE4;st&#xE4; ty&#xF6;st&#xE4; elokuvakulttuurin puolesta (1500e, rahoittajana Canal+).&#xD;
Elokuvataiteen valtionpalkinto 2008.&#xD;
Betoni-Jussi 2011 (perustelu: hieno ja merkitt&#xE4;v&#xE4; ura).</BiographicalNote>
<BiographicalNote henkilo-biografia-tyyppi="palkinnot">Jussi-palkinnot 1951 parhaasta ohjauksesta sek&#xE4; k&#xE4;sikirjoituksesta (yhdess&#xE4; FrilledLizard_0028 kanssa) elokuvasta Radio tekee murron.</BiographicalNote>
<ProfessionalAffiliation henkilo-kokoonpano-tyyppi="ty&#xF6;ryhm&#xE4;">
<Affiliation>Dingo_0018</Affiliation>
<AgentIdentifier>
Expand All @@ -50,7 +40,7 @@ Betoni-Jussi 2011 (perustelu: hieno ja merkitt&#xE4;v&#xE4; ura).</BiographicalN
</AgentDate>
<AgentDate>
<AgentDateEventType>52</AgentDateEventType>
<DateText>01.01.1900</DateText>
<DateText>01.01.1901</DateText>
<LocationName>Vantaa</LocationName>
</AgentDate>
<AgentPlace>
Expand Down
Loading