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

(-)a/Koha/Checkout.pm (+15 lines)
Lines 25-30 use Carp; Link Here
25
use Koha::Database;
25
use Koha::Database;
26
use DateTime;
26
use DateTime;
27
use Koha::DateUtils;
27
use Koha::DateUtils;
28
use Koha::Items;
28
29
29
use base qw(Koha::Object);
30
use base qw(Koha::Object);
30
31
Lines 59-64 sub is_overdue { Link Here
59
    return $is_overdue;
60
    return $is_overdue;
60
}
61
}
61
62
63
=head3 item
64
65
my $item = $checkout->item;
66
67
Return the checked out item
68
69
=cut
70
71
sub item {
72
    my ( $self ) = @_;
73
    my $item_rs = $self->_result->item;
74
    return Koha::Item->_new_from_dbic( $item_rs );
75
}
76
62
=head3 type
77
=head3 type
63
78
64
=cut
79
=cut
(-)a/t/db_dependent/Koha/Checkouts.t (-2 / +8 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 5;
22
use Test::More tests => 6;
23
23
24
use Koha::Checkouts;
24
use Koha::Checkouts;
25
use Koha::Database;
25
use Koha::Database;
Lines 86-91 subtest 'is_overdue' => sub { Link Here
86
        0, 'In Ten days, the item due yesterday will still be late' );
86
        0, 'In Ten days, the item due yesterday will still be late' );
87
};
87
};
88
88
89
subtest 'item' => sub {
90
    plan tests => 2;
91
    my $item = $retrieved_checkout_1->item;
92
    is( ref( $item ), 'Koha::Item', 'Koha::Checkout->item should return a Koha::Item' );
93
    is( $item->itemnumber, $item_1->{itemnumber}, 'Koha::Checkout->item should return the correct item' );
94
};
95
89
$retrieved_checkout_1->delete;
96
$retrieved_checkout_1->delete;
90
is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' );
97
is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' );
91
98
92
- 

Return to bug 17973