Bugzilla – Attachment 128520 Details for
Bug 29694
Add preference for setting marc-record system control number and identifier when saving biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29694: Add tests
Bug-29694-Add-tests.patch (text/plain), 2.76 KB, created by
David Gustafsson
on 2021-12-14 16:36:17 UTC
(
hide
)
Description:
Bug 29694: Add tests
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2021-12-14 16:36:17 UTC
Size:
2.76 KB
patch
obsolete
>From 772a717a9952883612a6ad9b5e35140a7d541d33 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Tue, 14 Dec 2021 16:09:50 +0100 >Subject: [PATCH] Bug 29694: Add tests > >--- > t/db_dependent/Biblio.t | 55 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 54 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index b9cb2a4398..f5d8b0f9d2 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 15; >+use Test::More tests => 16; > use Test::MockModule; > use Test::Warn; > use List::MoreUtils qw( uniq ); >@@ -40,6 +40,7 @@ my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; > Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); >+t::lib::Mocks::mock_preference('AutoAddSystemControlNumberAndMARCOrgCode', 0); > > my $builder = t::lib::TestBuilder->new; > >@@ -825,6 +826,58 @@ subtest "LinkBibHeadingsToAuthorities record generation tests" => sub { > ); > }; > >+subtest 'AutoAddSystemControlNumberAndMARCOrgCode' => sub { >+ plan tests => 4; >+ t::lib::Mocks::mock_preference('MARCOrgCode', 'OrgKoha'); >+ >+ my $biblio = $builder->build_sample_biblio(); >+ my $record = $biblio->metadata->record; >+ my $field; >+ >+ $field = $record->field('001'); >+ if ($field) { >+ $record->delete_fields($field); >+ } >+ $field = $record->field('003'); >+ if ($field) { >+ $record->delete_fields($field); >+ } >+ >+ $record->insert_fields_ordered(MARC::Field->new('001', '123123')); >+ $record->insert_fields_ordered(MARC::Field->new('003', 'OrgExternal')); >+ >+ my ($biblionumber) = AddBiblio($record->clone, ''); >+ my $saved_record = GetMarcBiblio({ biblionumber => $biblionumber }); >+ >+ is( >+ $saved_record->field('001')->data(), >+ '123123', >+ 'Record system control number has retained it\'s original value' >+ ); >+ is( >+ $saved_record->field('003')->data(), >+ 'OrgExternal', >+ 'Record control number identifier has retained it\'s original value' >+ ); >+ >+ t::lib::Mocks::mock_preference('AutoAddSystemControlNumberAndMARCOrgCode', 1); >+ >+ ($biblionumber) = AddBiblio($record, ''); >+ $saved_record = GetMarcBiblio({ biblionumber => $biblionumber }); >+ >+ is( >+ $saved_record->field('001')->data(), >+ $biblionumber, >+ 'Record system control number been set to Koha biblionumber' >+ ); >+ >+ is( >+ $saved_record->field('003')->data(), >+ 'OrgKoha', >+ 'Record control number identifier been set to MARCOrgCode syspref value' >+ ); >+}; >+ > # Cleanup > Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); > $schema->storage->txn_rollback; >-- >2.34.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29694
:
128517
|
128518
|
128519
| 128520