|
Lines 94-99
subtest 'item' => sub {
Link Here
|
| 94 |
is( $item->itemnumber, $item_1->itemnumber, 'Koha::Checkout->item should return the correct item' ); |
94 |
is( $item->itemnumber, $item_1->itemnumber, 'Koha::Checkout->item should return the correct item' ); |
| 95 |
}; |
95 |
}; |
| 96 |
|
96 |
|
|
|
97 |
$retrieved_checkout_1->delete; |
| 98 |
is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' ); |
| 99 |
|
| 97 |
subtest 'patron' => sub { |
100 |
subtest 'patron' => sub { |
| 98 |
plan tests => 3; |
101 |
plan tests => 3; |
| 99 |
my $patron = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); |
102 |
my $patron = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); |
|
Lines 127-133
subtest 'issuer' => sub {
Link Here
|
| 127 |
my $patron = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); |
130 |
my $patron = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); |
| 128 |
my $issuer = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); |
131 |
my $issuer = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); |
| 129 |
|
132 |
|
| 130 |
my $item = $builder->build_object( { class=> 'Koha::Items' } ); |
133 |
my $item = $builder->build_sample_item; |
| 131 |
my $checkout = Koha::Checkout->new({ |
134 |
my $checkout = Koha::Checkout->new({ |
| 132 |
borrowernumber => $patron->borrowernumber, |
135 |
borrowernumber => $patron->borrowernumber, |
| 133 |
issuer => $issuer->borrowernumber, |
136 |
issuer => $issuer->borrowernumber, |
|
Lines 141-148
subtest 'issuer' => sub {
Link Here
|
| 141 |
is( $i->borrowernumber, $issuer->borrowernumber, |
144 |
is( $i->borrowernumber, $issuer->borrowernumber, |
| 142 |
'Koha::Checkout->issued_by should return the correct patron' ); |
145 |
'Koha::Checkout->issued_by should return the correct patron' ); |
| 143 |
|
146 |
|
|
|
147 |
# Testing Koha::Old::Checkout->patron now |
| 144 |
my $issue_id = $checkout->issue_id; |
148 |
my $issue_id = $checkout->issue_id; |
| 145 |
C4::Circulation::MarkIssueReturned( $i->borrowernumber, $checkout->itemnumber ); |
149 |
C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $checkout->itemnumber ); |
| 146 |
$i->delete; |
150 |
$i->delete; |
| 147 |
my $old_issue = Koha::Old::Checkouts->find($issue_id); |
151 |
my $old_issue = Koha::Old::Checkouts->find($issue_id); |
| 148 |
is( $old_issue->issuer, undef, |
152 |
is( $old_issue->issuer, undef, |
|
Lines 151-158
subtest 'issuer' => sub {
Link Here
|
| 151 |
|
155 |
|
| 152 |
}; |
156 |
}; |
| 153 |
|
157 |
|
| 154 |
$retrieved_checkout_1->delete; |
|
|
| 155 |
is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' ); |
| 156 |
|
| 157 |
$schema->storage->txn_rollback; |
158 |
$schema->storage->txn_rollback; |
| 158 |
|
159 |
|
| 159 |
- |
|
|