Select Git revision
slubsipbuilderbagit.t 49.56 KiB
#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;
use Test::More tests => 122;
use Test::Output;
use Test::Exception;
use Test::File;
use Path::Tiny;
use File::Copy::Recursive qw(dircopy);
use File::Path qw(rmtree);
use File::Compare;
# *** Read before running tests ***
# Usage: perl -I lib/ t/slubsipbuilderbagit.t
# Warning: While running project "SLUB_SIP_Builder" two directories "export_dir_kitodo/bagit" and "tmp/bagit" will be created.
# Start scipt in the project directory to run all tests properly.
### prepare
BEGIN {
use Path::Tiny;
push @INC, Path::Tiny::path(__FILE__)->parent->parent->path("bin")->absolute->stringify;
require "slubsipbuilderbagit.pl";
$INC{'SLUB/LZA/SIPBuilderBagIt.pm'} = 1; # needed because inlined module
}
my $unpatched_mods=<<'UNPATCHED_MODS';
<?xml version="1.0" encoding="UTF-8"?>
<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"><titleInfo><nonSort xml:space="preserve">Der </nonSort><title>Fichtelberg</title><subTitle>Berg der unbekannten Rekorrde</subTitle></titleInfo><name type="personal"><namePart>Schneider, Dirk</namePart><role><roleTerm type="text">FilmemacherIn</roleTerm></role><role><roleTerm authority="marcrelator" type="code">fmk</roleTerm></role><nameIdentifier>(DE-627)1235502279 (DE-576)165502274</nameIdentifier></name><typeOfResource>moving image</typeOfResource><genre authority="rdacontent">zweidimensionales bewegtes Bild</genre><genre authority="gnd-content">Film</genre><originInfo><place><placeTerm type="code" authority="marccountry">xx</placeTerm></place><dateIssued encoding="marc">2014</dateIssued><issuance>monographic</issuance></originInfo><originInfo eventType="publication"><place><placeTerm type="text">[Leipzig]</placeTerm></place><publisher>top ten tv</publisher><dateIssued>[2014]</dateIssued></originInfo><language><languageTerm authority="iso639-2b" type="code">ger</languageTerm></language><physicalDescription><form authority="marccategory">electronic resource</form><form authority="marcsmd">remote</form><extent>1 Online-Ressource (1 Videodatei, 29:49) farbig</extent><form type="media" authority="rdamedia">Computermedien</form><form type="carrier" authority="rdacarrier">Online-Ressource</form></physicalDescription><targetAudience authority="marctarget">juvenile</targetAudience><note type="statement of responsibility" altRepGroup="00">ein Film von Dirk Schneider</note><note>Dokumentarfilm. Deutschland. 2014</note><relatedItem type="series"><titleInfo><title>MDR</title></titleInfo></relatedItem><relatedItem type="series"><titleInfo><title>Der Osten - entdecke wo du lebst</title></titleInfo></relatedItem><identifier type="oclc">946544758</identifier><recordInfo><descriptionStandard>rda</descriptionStandard><recordContentSource authority="marcorg">DE-576</recordContentSource><recordCreationDate encoding="marc">160304</recordCreationDate><recordChangeDate encoding="iso8601">20160510144338.0</recordChangeDate><recordIdentifier source="DE-576">457035137</recordIdentifier><recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl
(Revision 1.119 2018/06/21)</recordOrigin><languageOfCataloging><languageTerm authority="iso639-2b" type="code">ger</languageTerm></languageOfCataloging></recordInfo></mods>
UNPATCHED_MODS
my $patched_mods=<<'PATCHED_MODS';
<?xml version="1.0" encoding="UTF-8"?>
<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.6" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-6.xsd"><titleInfo><nonSort xml:space="preserve">Der </nonSort><title>Fichtelberg</title><subTitle>Berg der unbekannten Rekorrde</subTitle></titleInfo><name type="personal"><namePart>Schneider, Dirk</namePart><role><roleTerm type="text">FilmemacherIn</roleTerm></role><role><roleTerm authority="marcrelator" type="code">fmk</roleTerm></role><nameIdentifier>(DE-627)1235502279 (DE-576)165502274</nameIdentifier></name><typeOfResource>moving image</typeOfResource><genre authority="rdacontent">zweidimensionales bewegtes Bild</genre><genre authority="gnd-content">Film</genre><originInfo><place><placeTerm type="code" authority="marccountry">xx</placeTerm></place><dateIssued encoding="marc">2014</dateIssued><issuance>monographic</issuance></originInfo><originInfo eventType="publication"><place><placeTerm type="text">[Leipzig]</placeTerm></place><publisher>top ten tv</publisher><dateIssued>[2014]</dateIssued></originInfo><language><languageTerm authority="iso639-2b" type="code">ger</languageTerm></language><physicalDescription><form authority="marccategory">electronic resource</form><form authority="marcsmd">remote</form><extent>1 Online-Ressource (1 Videodatei, 29:49) farbig</extent><form type="media" authority="rdamedia">Computermedien</form><form type="carrier" authority="rdacarrier">Online-Ressource</form></physicalDescription><targetAudience authority="marctarget">juvenile</targetAudience><note type="statement of responsibility" altRepGroup="00">ein Film von Dirk Schneider</note><note>Dokumentarfilm. Deutschland. 2014</note><relatedItem type="series"><titleInfo><title>MDR</title></titleInfo></relatedItem><relatedItem type="series"><titleInfo><title>Der Osten - entdecke wo du lebst</title></titleInfo></relatedItem><identifier type="oclc">946544758</identifier><recordInfo><descriptionStandard>rda</descriptionStandard><recordContentSource authority="marcorg">DE-576</recordContentSource><recordCreationDate encoding="marc">160304</recordCreationDate><recordChangeDate encoding="iso8601">20160510144338.0</recordChangeDate><recordIdentifier source="DE-576">457035137</recordIdentifier><recordOrigin>Converted from MARCXML to MODS version 3.6 using MARC21slim2MODS3-6.xsl
(Revision 1.119 2018/06/21)</recordOrigin><languageOfCataloging><languageTerm authority="iso639-2b" type="code">ger</languageTerm></languageOfCataloging></recordInfo></mods>
PATCHED_MODS
my $unpatched_mods_obj = XML::LibXML->load_xml(string => $unpatched_mods);
my $unpatched_marcblob=<<'UNPATCHED_MARCBLOB';
<?xml version="1.0"?>
<record xmlns="http://www.loc.gov/MARC21/slim">
<leader> cgm a22 4500</leader>
<controlfield tag="001">457035137</controlfield>
<controlfield tag="003">DE-576</controlfield>
<controlfield tag="005">20160510144338.0</controlfield>
<controlfield tag="006">m o | | </controlfield>
<controlfield tag="007">cr uuu---uuuuu</controlfield>
<controlfield tag="007">vu uuuuuu</controlfield>
<controlfield tag="008">160304s2014 xx ger c</controlfield>
<datafield tag="035" ind1=" " ind2=" ">
<subfield code="a">(DE-627)1655506501</subfield>
</datafield>
<datafield tag="035" ind1=" " ind2=" ">
<subfield code="a">(DE-576)457035137</subfield>
</datafield>
<datafield tag="035" ind1=" " ind2=" ">
<subfield code="a">(DE-599)BSZ457035137</subfield>
</datafield>
<datafield tag="035" ind1=" " ind2=" ">
<subfield code="a">(OCoLC)946544758</subfield>
</datafield>
<datafield tag="040" ind1=" " ind2=" ">
<subfield code="a">DE-576</subfield>
<subfield code="b">ger</subfield>
<subfield code="c">DE-576</subfield>
<subfield code="e">rda</subfield>
</datafield>