Bug 14957: Add tests for subfield order
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
8425cf1e13
commit
3247eb9a73
1 changed files with 48 additions and 1 deletions
|
@ -25,7 +25,7 @@ use C4::Context;
|
|||
use C4::Biblio qw( AddBiblio ModBiblio DelBiblio GetMarcBiblio );
|
||||
use Koha::Database;
|
||||
|
||||
use Test::More tests => 23;
|
||||
use Test::More tests => 24;
|
||||
use Test::MockModule;
|
||||
|
||||
use Koha::MarcOverlayRules;
|
||||
|
@ -570,6 +570,53 @@ subtest 'Record fields has been overwritten when add = 1, append = 1, remove = 1
|
|||
|
||||
};
|
||||
|
||||
subtest 'subfields order' => sub {
|
||||
plan tests => 2;
|
||||
|
||||
$rule->set(
|
||||
{
|
||||
'add' => 0,
|
||||
'append' => 0,
|
||||
'remove' => 0,
|
||||
'delete' => 0,
|
||||
}
|
||||
)->store();
|
||||
|
||||
my $incoming_record = build_record(
|
||||
[
|
||||
[ '250', 'a', '256 bottles of beer on the wall' ],
|
||||
[ '250', 'a', '250 bottles of beer on the wall' ],
|
||||
[ '500', 'a', 'One bottle of beer in the fridge' ],
|
||||
]
|
||||
);
|
||||
|
||||
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
|
||||
|
||||
is(
|
||||
$merged_record->as_formatted,
|
||||
$orig_record->as_formatted,
|
||||
'Original record not modified - order of subfields not modified'
|
||||
);
|
||||
|
||||
$rule->set(
|
||||
{
|
||||
'add' => 1,
|
||||
'append' => 1,
|
||||
'remove' => 1,
|
||||
'delete' => 1,
|
||||
}
|
||||
)->store();
|
||||
|
||||
$merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
|
||||
|
||||
is(
|
||||
$merged_record->as_formatted,
|
||||
$incoming_record->as_formatted,
|
||||
'Original record modified - order of subfields has been modified'
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
# Test rule tag specificity
|
||||
|
||||
# Protect field 500 with more specific tag value
|
||||
|
|
Loading…
Reference in a new issue