From a85b8080d8c8b0ec68f99466efb331c57b8693f3 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sun, 29 Apr 2018 14:09:55 +0000 Subject: [PATCH] Bug 20678 - Added unit test for new subroutine DeleteBiblioInBatch() This new subroutine is in C4/ImportBatches.pm and it calls a new internal subroutine _delete_import_record_marc Test plan: 1.Enter koha shell: sudo koha-shell 2. perl t/db_dependent/ImportBatch.pm 3. Notice unit test 12 passes: 'ok 12 - No biblio expected since we deleted the biblio from the batch' Sponsored-By: Toi Ohomai Institute of Technology --- t/db_dependent/ImportBatch.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/ImportBatch.t b/t/db_dependent/ImportBatch.t index 788be3f..18d4f24 100644 --- a/t/db_dependent/ImportBatch.t +++ b/t/db_dependent/ImportBatch.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use Modern::Perl; -use Test::More tests => 14; +use Test::More tests => 15; use Cwd qw(abs_path); use File::Temp qw/tempfile/; @@ -144,6 +144,11 @@ $dbh->do( "DELETE FROM items WHERE itemnumber=?", undef, $itemno ); is( @a, 0, 'No item numbers expected since we deleted the item' ); $dbh->do( $sql, undef, undef, $import_record_id ); # remove link again +#Test DeleteBiblioInBatch +my @a = DeleteBiblioInBatch( $import_record_id); #Remove the MARC record from import_biblios and import_records tables +my $biblio_in_import_records = $dbh->do('SELECT * FROM import_records WHERE import_batch_id = "$import_record_id"'); +is( $biblio_in_import_records, "0E0", 'No biblio expected since we deleted the biblio from the batch' ); + # fresh data my $sample_import_batch3 = { matcher_id => 3, -- 2.1.4