From f4285b4955a0d31ade96be07244f3b6d5c938572 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 24 Dec 2013 10:11:32 +0100 Subject: [PATCH] Bug 11439: UT: Improve XISBN.t The tests should be executed into a transaction and the SimpleSearch routine correctly mocked. Test plan: Verify that prove t/db_dependent/XISBN.t returns green. Signed-off-by: Chris Cormack Signed-off-by: Galen Charlton (cherry picked from commit 0d71139fff68523beee3f14ea26e0d670eb7c409) Signed-off-by: Tomas Cohen Arazi Cleaned stuff not for 3.12.x and added the rollback call at the end. --- t/db_dependent/XISBN.t | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/t/db_dependent/XISBN.t b/t/db_dependent/XISBN.t index 8698f06353..b9104682ef 100755 --- a/t/db_dependent/XISBN.t +++ b/t/db_dependent/XISBN.t @@ -5,20 +5,20 @@ use Modern::Perl; -# use Test::Class::Load qw ( t/db_dependent/ ); use Test::More tests => 5; use MARC::Record; use C4::Biblio; use C4::XISBN; -use Data::Dumper; use C4::Context; +use Test::MockModule; BEGIN { use_ok('C4::XISBN'); } -# KohaTest::clear_test_database(); -# KohaTest::create_test_database(); +my $dbh = C4::Context->dbh; +$dbh->{RaiseError} = 1; +$dbh->{AutoCommit} = 0; my $context = C4::Context->new; @@ -61,11 +61,6 @@ is( $results_xisbn->[0]->{biblionumber}, $biblionumber3, "Gets correct biblionumber from a book with a similar isbn using XISBN." ); -# clean up after ourselves -DelBiblio($biblionumber1); -DelBiblio($biblionumber2); -DelBiblio($biblionumber3); - # Util subs # Add new biblio with isbn and return biblionumber @@ -79,3 +74,4 @@ sub _add_biblio_with_isbn { return $biblionumber; } +$dbh->rollback; -- 2.39.5