|
Lines 133-156
subtest 'issuer' => sub {
Link Here
|
| 133 |
my $item = $builder->build_sample_item; |
133 |
my $item = $builder->build_sample_item; |
| 134 |
my $checkout = Koha::Checkout->new({ |
134 |
my $checkout = Koha::Checkout->new({ |
| 135 |
borrowernumber => $patron->borrowernumber, |
135 |
borrowernumber => $patron->borrowernumber, |
| 136 |
issuer => $issuer->borrowernumber, |
136 |
issuer_id => $issuer->borrowernumber, |
| 137 |
itemnumber => $item->itemnumber, |
137 |
itemnumber => $item->itemnumber, |
| 138 |
branchcode => $library->{branchcode}, |
138 |
branchcode => $library->{branchcode}, |
| 139 |
})->store; |
139 |
})->store; |
| 140 |
|
140 |
|
| 141 |
my $i = $checkout->issued_by; |
141 |
my $i = $checkout->issuer; |
| 142 |
is( ref($i), 'Koha::Patron', |
142 |
is( ref($i), 'Koha::Patron', |
| 143 |
'Koha::Checkout->issued_by should return a Koha::Patron' ); |
143 |
'Koha::Checkout->issuer should return a Koha::Patron' ); |
| 144 |
is( $i->borrowernumber, $issuer->borrowernumber, |
144 |
is( $i->borrowernumber, $issuer->borrowernumber, |
| 145 |
'Koha::Checkout->issued_by should return the correct patron' ); |
145 |
'Koha::Checkout->issuer should return the correct patron' ); |
| 146 |
|
146 |
|
| 147 |
# Testing Koha::Old::Checkout->patron now |
147 |
# Testing Koha::Old::Checkout->patron now |
| 148 |
my $issue_id = $checkout->issue_id; |
148 |
my $issue_id = $checkout->issue_id; |
| 149 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $checkout->itemnumber ); |
149 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $checkout->itemnumber ); |
| 150 |
$i->delete; |
150 |
$i->delete; |
| 151 |
my $old_issue = Koha::Old::Checkouts->find($issue_id); |
151 |
my $old_issue = Koha::Old::Checkouts->find($issue_id); |
| 152 |
is( $old_issue->issuer, undef, |
152 |
is( $old_issue->issuer_id, undef, |
| 153 |
'Koha::Checkout->issuer should return undef if the patron record has been deleted' |
153 |
'Koha::Checkout->issuer_id should return undef if the patron record has been deleted' |
| 154 |
); |
154 |
); |
| 155 |
|
155 |
|
| 156 |
}; |
156 |
}; |
| 157 |
- |
|
|