-
Notifications
You must be signed in to change notification settings - Fork 11
[FINNA-4941] Add tests for EAD, AIPA, EAC-CPF and ForwardAuthority #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * Finna AIPA Record Driver Test Class | ||
| * | ||
| * PHP version 8 | ||
| * | ||
| * Copyright (C) The National Library of Finland 2023. | ||
| * | ||
| * 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\Finna\Record; | ||
|
|
||
| use RecordManager\Finna\Record\Aipa; | ||
|
|
||
| /** | ||
| * Finna AIPA 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 AipaTest extends \RecordManagerTest\Base\Record\RecordTestBase | ||
| { | ||
| /** | ||
| * Test AIPA record handling | ||
| * | ||
| * @return void | ||
| */ | ||
| public function testAipa1() | ||
| { | ||
| $record = $this->createRecord( | ||
| Aipa::class, | ||
| 'aipa1.xml', | ||
| [], | ||
| 'Finna', | ||
| [ | ||
| $this->createMock(\RecordManager\Base\Http\HttpService::class), | ||
| null, | ||
| $this->createMock(\RecordManager\Base\Record\PluginManager::class), | ||
| ], | ||
| ); | ||
| $fields = $record->toSolrArray(); | ||
| unset($fields['fullrecord']); | ||
|
|
||
| $expected = [ | ||
| 'allfields' => [ | ||
| 'oai:aineistopaketit.finna.fi:6888', | ||
| 'Moottorisahat metsätyön välineenä Suomessa', | ||
| '2025-10-08T12:09:17Z', | ||
| 'Ennen moottorisahaa puiden kaataminen ja katkominen tehtiin käsisahoilla ja kirveillä, ' | ||
| . 'mikä oli hidasta ja fyysisesti raskasta.', | ||
| 'https://aineistopaketit.finna.fi/image.jpg', | ||
| 'Lusto – Suomen Metsämuseo', | ||
| 'fi', | ||
| 'aipa-research', | ||
| 'moottorisahat', | ||
| 'motorsågar', | ||
| 'mohtorsahát', | ||
| 'chain saws', | ||
| 'metsätyö', | ||
| 'skogsarbete', | ||
| 'vuovdebargu', | ||
| 'forest work', | ||
| 'Suomen Metsämuseo Lustossa on laaja moottorisahojen kokoelma ' | ||
| . 'ja lisäksi muuta moottoorisahoihin liittyvää aineistoa', | ||
| 'Valtaosa Suomen Metsämuseo Luston kokoelman moottorisahoista sijoittuu 1960-80-luvuille.', | ||
| '182', | ||
| 'node-6888', | ||
| ], | ||
| 'author' => [ | ||
| 'Lusto – Suomen Metsämuseo', | ||
| ], | ||
| 'author2' => [], | ||
| 'author_facet' => [ | ||
| 'Lusto – Suomen Metsämuseo', | ||
| ], | ||
| 'author_sort' => 'Lusto – Suomen Metsämuseo', | ||
| 'author_corporate' => [], | ||
| 'contents' => [ | ||
| 'Ennen moottorisahaa puiden kaataminen ja katkominen tehtiin käsisahoilla ja kirveillä, ' | ||
| . 'mikä oli hidasta ja fyysisesti raskasta.', | ||
| ], | ||
| 'ctrlnum' => [ | ||
| 'node-6888', | ||
| ], | ||
| 'datasource_str_mv' => '__unit_test_no_source__', | ||
| 'description' => 'Ennen moottorisahaa puiden kaataminen ja katkominen tehtiin käsisahoilla ja kirveillä, ' | ||
| . 'mikä oli hidasta ja fyysisesti raskasta.', | ||
| 'doi_str_mv' => [], | ||
| 'educational_material_type_str_mv' => 'aipa-research', | ||
| 'era_facet' => [], | ||
| 'era' => [], | ||
| 'file_identifier_str_mv' => [], | ||
| 'format' => 'aipa-research', | ||
| 'format_ext_str_mv' => 'aipa-research', | ||
| 'fulltext' => '', | ||
| 'geographic_facet' => [], | ||
| 'geographic' => [], | ||
| 'hierarchy_parent_title' => [], | ||
| 'isbn' => [], | ||
| 'issn' => [], | ||
| 'language' => [ | ||
| 'fi', | ||
| ], | ||
| 'location_geo' => [], | ||
| 'main_date_str' => '2025', | ||
| 'main_date' => '2025-01-01T00:00:00Z', | ||
| 'media_type_str_mv' => [], | ||
| 'online_urls_str_mv' => [], | ||
| 'publication_daterange' => '[2025-01-01 TO 2025-12-31]', | ||
| 'publishDate' => [ | ||
| '2025', | ||
| ], | ||
| 'publishDateRange' => [ | ||
| '[2025-01-01 TO 2025-12-31]', | ||
| ], | ||
| 'publishDateSort' => '2025', | ||
| 'publisher' => [], | ||
| 'record_format' => 'aipa', | ||
| 'search_daterange_mv' => [ | ||
| '[2025-01-01 TO 2025-12-31]', | ||
| ], | ||
| 'series' => [], | ||
| 'source_str_mv' => '__unit_test_no_source__', | ||
| 'title_alt' => [], | ||
| 'title_en_txt' => '', | ||
| 'title_fi_txt' => 'Moottorisahat metsätyön välineenä Suomessa', | ||
| 'title_se_txt' => '', | ||
| 'title_sv_txt' => '', | ||
| 'title_full' => 'Moottorisahat metsätyön välineenä Suomessa', | ||
| 'title_short' => 'Moottorisahat metsätyön välineenä Suomessa', | ||
| 'title_sort' => 'moottorisahat metsätyön välineenä suomessa', | ||
| 'title_sub' => '', | ||
| 'title' => 'Moottorisahat metsätyön välineenä Suomessa', | ||
| 'topic_facet' => [ | ||
| 'moottorisahat', | ||
| 'motorsågar', | ||
| 'mohtorsahát', | ||
| 'chain saws', | ||
| 'metsätyö', | ||
| 'skogsarbete', | ||
| 'vuovdebargu', | ||
| 'forest work', | ||
| ], | ||
| 'topic_id_str_mv' => [ | ||
| 0 => 'http://www.yso.fi/onto/yso/p10489', | ||
| 1 => 'http://www.yso.fi/onto/yso/p2982', | ||
| ], | ||
| 'topic' => [ | ||
| 'moottorisahat', | ||
| 'motorsågar', | ||
| 'mohtorsahát', | ||
| 'chain saws', | ||
| 'metsätyö', | ||
| 'skogsarbete', | ||
| 'vuovdebargu', | ||
| 'forest work', | ||
| ], | ||
| 'url' => [], | ||
| 'usage_rights_str_mv' => [ | ||
| 'restricted', | ||
| ], | ||
| 'usage_rights_ext_str_mv' => [ | ||
| 'restricted', | ||
| ], | ||
| ]; | ||
|
|
||
| $this->compareArray($expected, $fields, 'toSolrArray'); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * Finna EAC-CPF Record Driver Test Class | ||
| * | ||
| * PHP version 8 | ||
| * | ||
| * Copyright (C) The National Library of Finland 2023. | ||
| * | ||
| * 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\Finna\Record; | ||
|
|
||
| use RecordManager\Finna\Record\Eaccpf; | ||
|
|
||
| /** | ||
| * Finna EAC-CPF 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 EaccpfTest extends \RecordManagerTest\Base\Record\RecordTestBase | ||
| { | ||
| /** | ||
| * Test EAC-CPF record handling | ||
| * | ||
| * @return void | ||
| */ | ||
| public function testEaccpf1() | ||
| { | ||
| $record = $this->createRecord( | ||
| Eaccpf::class, | ||
| 'eaccpf1.xml', | ||
| [], | ||
| 'Finna', | ||
| [$this->createMock(\RecordManager\Base\Http\HttpService::class)] | ||
| ); | ||
| $fields = $record->toSolrArray(); | ||
| unset($fields['fullrecord']); | ||
|
|
||
| $expected = [ | ||
| 'record_format' => 'eaccpf', | ||
| 'allfields' => [ | ||
| 'Kansallisarkisto', | ||
| 'Tietoa kirjailijan elämästä', | ||
| 'Sukunimi Etunimi', | ||
| 'Toinensuku Toinennimi', | ||
| ], | ||
| 'source' => 'Kansallisarkisto', | ||
| 'record_type' => 'person', | ||
| 'heading' => 'Sukunimi Etunimi', | ||
| 'use_for' => [ | ||
| 'Toinensuku Toinennimi', | ||
| ], | ||
| 'birth_date' => '1950', | ||
| 'death_date' => '2000', | ||
| 'birth_place' => 'Tampere', | ||
| 'death_place' => 'Joensuu', | ||
| 'related_place' => [ | ||
| 'Helsinki', | ||
| 'Oulu', | ||
| ], | ||
| 'field_of_activity' => [], | ||
| 'occupation' => [ | ||
| 'runoilija', | ||
| 'kirjailija', | ||
| ], | ||
| 'language' => 'fin', | ||
| 'agency_str_mv' => 'Kansallisarkisto', | ||
| 'datasource_str_mv' => '__unit_test_no_source__', | ||
| 'source_str_mv' => '__unit_test_no_source__', | ||
| ]; | ||
|
|
||
| $this->compareArray($expected, $fields, 'toSolrArray'); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.