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

(-)a/Koha/Checkout.pm (+14 lines)
Lines 74-79 sub item { Link Here
74
    return Koha::Item->_new_from_dbic( $item_rs );
74
    return Koha::Item->_new_from_dbic( $item_rs );
75
}
75
}
76
76
77
=head3 patron
78
79
my $patron = $checkout->patron
80
81
Return the patron for who the checkout has been done
82
83
=cut
84
85
sub patron {
86
    my ( $self ) = @_;
87
    my $patron_rs = $self->_result->borrower;
88
    return Koha::Patron->_new_from_dbic( $patron_rs );
89
}
90
77
=head3 type
91
=head3 type
78
92
79
=cut
93
=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 => 6;
22
use Test::More tests => 7;
23
23
24
use Koha::Checkouts;
24
use Koha::Checkouts;
25
use Koha::Database;
25
use Koha::Database;
Lines 93-98 subtest 'item' => sub { Link Here
93
    is( $item->itemnumber, $item_1->{itemnumber}, 'Koha::Checkout->item should return the correct item' );
93
    is( $item->itemnumber, $item_1->{itemnumber}, 'Koha::Checkout->item should return the correct item' );
94
};
94
};
95
95
96
subtest 'patron' => sub {
97
    plan tests => 2;
98
    my $p = $new_checkout_1->patron;
99
    is( ref($p), 'Koha::Patron', 'Koha::Checkout->patron should return a Koha::Patron' );
100
    is( $p->borrowernumber, $patron->{borrowernumber}, 'Koha::Checkout->patron should return the correct patron' );
101
};
102
96
$retrieved_checkout_1->delete;
103
$retrieved_checkout_1->delete;
97
is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' );
104
is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' );
98
105
99
- 

Return to bug 18401