Bug 24901: Minor refactor of tests

Test plan:
0/ Read the change and verify it makes sense

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2020-03-18 19:25:57 +00:00
parent d4254cf244
commit eed5e858b9
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -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;