Bug 28676: Unit test

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 869f1c758c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2021-07-07 15:39:21 +00:00 committed by Fridolin Somers
parent 9dbf469605
commit 97dcf5ded6
1 changed files with 5 additions and 1 deletions

View File

@ -167,7 +167,7 @@ subtest "GetMarcFromKohaField" => sub {
};
subtest "Authority creation with default linker" => sub {
plan tests => 2;
plan tests => 4;
# Automatic authority creation
t::lib::Mocks::mock_preference('LinkerModule', 'Default');
t::lib::Mocks::mock_preference('BiblioAddsAuthorities', 1);
@ -188,6 +188,10 @@ subtest "Authority creation with default linker" => sub {
my ($num_changed,$results) = LinkBibHeadingsToAuthorities($linker, $marc_record, "",undef);
is( $num_changed, 0, "We shouldn't link or create a new record");
ok( !defined $results->{added}, "If we have multiple matches, we shouldn't create a new record");
($num_changed,$results) = LinkBibHeadingsToAuthorities($linker, $marc_record, "",undef);
is( $num_changed, 0, "We shouldn't link or create a new record using cached result");
ok( !defined $results->{added}, "If we have multiple matches, we shouldn't create a new record on second instance");
};