Bug 24267: Unit tests

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 1d457f370c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2019-12-19 17:37:23 +00:00 committed by Lucas Gass
parent 42f423675a
commit ff114d6bfa
1 changed files with 25 additions and 1 deletions

View File

@ -20,7 +20,7 @@
use Modern::Perl;
use FindBin;
use Test::More tests => 4;
use Test::More tests => 5;
use Test::Warn;
use t::lib::Mocks qw( mock_preference );
@ -57,6 +57,30 @@ subtest '_add_rowdata' => sub {
test_add_rowdata();
};
subtest ImportBreedingAuth => sub {
plan tests => 4;
my $record = MARC::Record->new();
$record->append_fields(
MARC::Field->new('001', '4815162342'),
MARC::Field->new('100', ' ', ' ', a => 'Jansson, Tove'),
);
my $breedingid = C4::Breeding::ImportBreedingAuth($record,"kidclamp","UTF8");
ok( $breedingid, "We got a breeding id back");
my $breedingid_1 = C4::Breeding::ImportBreedingAuth($record,"kidclamp","UTF8");
is( $breedingid, $breedingid_1, "For the same record, we get the same id");
$breedingid_1 = C4::Breeding::ImportBreedingAuth($record,"marcelr","UTF8");
is( $breedingid, $breedingid_1, "For the same record in a different file, we get a new id");
my $record_1 = MARC::Record->new();
$record_1->append_fields(
MARC::Field->new('001', '8675309'),
MARC::Field->new('100', ' ', ' ', a => 'Cooper, Susan'),
);
my $breedingid_2 = C4::Breeding::ImportBreedingAuth($record_1,"kidclamp","UTF8");
isnt( $breedingid, $breedingid_2, "For a new record, we get a new id");
};
#-------------------------------------------------------------------------------
sub test_build_translate_query {