From eed5e858b95f5f95a8e7425b9d599055c36320fc Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 18 Mar 2020 19:25:57 +0000 Subject: [PATCH] Bug 24901: Minor refactor of tests Test plan: 0/ Read the change and verify it makes sense Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- t/db_dependent/Circulation/transferbook.t | 27 +++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/t/db_dependent/Circulation/transferbook.t b/t/db_dependent/Circulation/transferbook.t index 835490351c..e37324f147 100644 --- a/t/db_dependent/Circulation/transferbook.t +++ b/t/db_dependent/Circulation/transferbook.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 3; +use Test::More tests => 2; use t::lib::TestBuilder; use t::lib::Mocks; @@ -27,16 +27,25 @@ use Koha::DateUtils qw( dt_from_string ); my $builder = t::lib::TestBuilder->new; -my $library = $builder->build( { source => 'Branch' } ); +subtest 'transfer a non-existant item' => sub { + plan tests => 2; -#Transfert on unknown barcode -my $item = $builder->build_sample_item(); -my $badbc = $item->barcode; -$item->delete; + my $library = $builder->build( { source => 'Branch' } ); -my ( $dotransfer, $messages ) = C4::Circulation::transferbook( $library->{branchcode}, $badbc ); -is( $dotransfer, 0, "Can't transfer a bad barcode"); -is_deeply( $messages, { BadBarcode => $badbc }, "We got the expected barcode"); + #Transfert on unknown barcode + my $item = $builder->build_sample_item(); + my $badbc = $item->barcode; + $item->delete; + + my ( $dotransfer, $messages ) = + C4::Circulation::transferbook( $library->{branchcode}, $badbc ); + is( $dotransfer, 0, "Can't transfer a bad barcode" ); + is_deeply( + $messages, + { BadBarcode => $badbc }, + "We got the expected barcode" + ); +}; subtest 'transfer an issued item' => sub { plan tests => 3;