View | Details | Raw Unified | Return to bug 24901
Collapse All | Expand All

(-)a/t/db_dependent/Circulation/transferbook.t (-10 / +20 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 3;
20
use Test::More tests => 2;
21
use t::lib::TestBuilder;
21
use t::lib::TestBuilder;
22
use t::lib::Mocks;
22
use t::lib::Mocks;
23
23
Lines 27-42 use Koha::DateUtils qw( dt_from_string ); Link Here
27
27
28
my $builder = t::lib::TestBuilder->new;
28
my $builder = t::lib::TestBuilder->new;
29
29
30
my $library = $builder->build( { source => 'Branch' } );
30
subtest 'transfer a non-existant item' => sub {
31
    plan tests => 2;
31
32
32
#Transfert on unknown barcode
33
    my $library = $builder->build( { source => 'Branch' } );
33
my $item = $builder->build_sample_item();
34
my $badbc = $item->barcode;
35
$item->delete;
36
34
37
my ( $dotransfer, $messages ) = C4::Circulation::transferbook( $library->{branchcode}, $badbc );
35
    #Transfert on unknown barcode
38
is( $dotransfer, 0, "Can't transfer a bad barcode");
36
    my $item  = $builder->build_sample_item();
39
is_deeply( $messages, { BadBarcode => $badbc }, "We got the expected barcode");
37
    my $badbc = $item->barcode;
38
    $item->delete;
39
40
    my ( $dotransfer, $messages ) =
41
      C4::Circulation::transferbook( $library->{branchcode}, $badbc );
42
    is( $dotransfer, 0, "Can't transfer a bad barcode" );
43
    is_deeply(
44
        $messages,
45
        { BadBarcode => $badbc },
46
        "We got the expected barcode"
47
    );
48
};
40
49
41
subtest 'transfer an issued item' => sub {
50
subtest 'transfer an issued item' => sub {
42
    plan tests => 3;
51
    plan tests => 3;
Lines 76-78 subtest 'transfer an issued item' => sub { Link Here
76
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
85
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
77
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
86
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
78
};
87
};
79
- 
88
89

Return to bug 24901