Bug 27981: (QA follow-up) GetMarcBiblio was removed from codebase

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomás Cohen Arazi 2022-09-12 15:28:08 -03:00
parent b2cce0d9f5
commit f60a9c50dc
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -826,23 +826,28 @@ subtest "LinkBibHeadingsToAuthorities record generation tests" => sub {
};
subtest 'autoControlNumber tests' => sub {
plan tests => 3;
t::lib::Mocks::mock_preference('autoControlNumber', 'OFF');
my $record = MARC::Record->new();
my ($biblionumber) = C4::Biblio::AddBiblio($record, '');
$record = GetMarcBiblio({biblionumber => $biblionumber});
my ($biblio_id) = C4::Biblio::AddBiblio($record, '');
my $biblio = Koha::Biblios->find($biblio_id);
$record = $biblio->metadata->record;
is($record->field('001'), undef, '001 not set when pref is off');
t::lib::Mocks::mock_preference('autoControlNumber', 'biblionumber');
C4::Biblio::ModBiblio($record, $biblionumber, "", { skip_record_index => 1, disable_autolink => 1 });
$record = GetMarcBiblio({biblionumber => $biblionumber});
is($record->field('001')->as_string(), $biblionumber, '001 set to biblionumber when pref set and field is blank');
C4::Biblio::ModBiblio($record, $biblio_id, "", { skip_record_index => 1, disable_autolink => 1 });
$biblio->discard_changes;
$record = $biblio->metadata->record;
is($record->field('001')->as_string(), $biblio_id, '001 set to biblionumber when pref set and field is blank');
$record->field('001')->update('Not biblionumber');
C4::Biblio::ModBiblio($record, $biblionumber, "", { skip_record_index => 1, disable_autolink => 1 });
$record = GetMarcBiblio({biblionumber => $biblionumber});
C4::Biblio::ModBiblio($record, $biblio_id, "", { skip_record_index => 1, disable_autolink => 1 });
$biblio->discard_changes;
$record = $biblio->metadata->record;
is($record->field('001')->as_string(), 'Not biblionumber', '001 not set to biblionumber when pref set and field exists');
};