Bug 28915: Add test for AddModificationTemplateAction

To test:
1. prove t/db_dependent/MarcModificationTemplates.t

Observe test failing with the following error

t/db_dependent/MarcModificationTemplates.t .. 1/135 Control fields (generally, just tags below 010) do not have subfields, use data() at /home/koha/Koha/Koha/SimpleMARC.pm line 490.

Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Lari Taskula 2026-04-29 13:54:36 +03:00 committed by Pedro Amorim
parent bc54c59423
commit fed20335a4
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 38 additions and 1 deletions

View File

@ -3,7 +3,7 @@
use Modern::Perl;
use Test::NoWarnings;
use Test::More tests => 134;
use Test::More tests => 135;
use Koha::Database;
use Koha::SimpleMARC;
@ -326,6 +326,18 @@ is(
'Add eleventh action: add additional field existent 007'
);
is(
AddModificationTemplateAction(
$template_id, 'update_field', 0,
'008', '35', 'eng', '', '',
'', '', '',
'if', '041', 'a', 'equals', '^eng$', '1',
'Update existent field 008$35 with "eng"'
),
1,
'Add twelfth action: update field 008 character position 35-37 with "eng" if 041$a =~ /^eng$/'
);
my $record = new_record();
is( ModifyRecordWithTemplate( $template_id, $record ), undef, "The ModifyRecordWithTemplate returns undef" );
@ -586,6 +598,11 @@ sub new_record {
my $record = MARC::Record->new;
$record->leader('03174nam a2200445 a 4500');
my @fields = (
MARC::Field->new( '008', '231124s2023 en |||| |0| 0||||| ' ),
MARC::Field->new(
'041', ' ', ' ',
a => 'eng',
),
MARC::Field->new(
100, '1', ' ',
a => 'Knuth, Donald Ervin',
@ -630,6 +647,11 @@ sub expected_record_1 {
MARC::Field->new(
'007', 'vxcdq',
),
MARC::Field->new( '008', '231124s2023 en |||| |0| 0|eng| ' ),
MARC::Field->new(
'041', ' ', ' ',
a => 'eng',
),
MARC::Field->new(
100, '1', ' ',
a => 'Knuth, Donald Ervin',
@ -677,6 +699,11 @@ sub expected_record_2 {
my $record = MARC::Record->new;
$record->leader('03174nam a2200445 a 4500');
my @fields = (
MARC::Field->new( '008', '231124s2023 en |||| |0| 0||||| ' ),
MARC::Field->new(
'041', ' ', ' ',
a => 'eng',
),
MARC::Field->new(
100, '1', ' ',
a => 'Knuth, Donald Ervin',
@ -718,6 +745,11 @@ sub expected_record_3 {
my $record = MARC::Record->new;
$record->leader('03174nam a2200445 a 4500');
my @fields = (
MARC::Field->new( '008', '231124s2023 en |||| |0| 0||||| ' ),
MARC::Field->new(
'041', ' ', ' ',
a => 'eng',
),
MARC::Field->new(
100, '1', ' ',
a => 'Knuth, Donald Ervin',
@ -757,6 +789,11 @@ sub expected_record_4 {
my $record = MARC::Record->new;
$record->leader('03174nam a2200445 a 4500');
my @fields = (
MARC::Field->new( '008', '231124s2023 en |||| |0| 0||||| ' ),
MARC::Field->new(
'041', ' ', ' ',
a => 'eng',
),
MARC::Field->new(
100, '1', ' ',
a => 'Knuth, Donald Ervin',