Lines 706-712
subtest 'adjust() tests' => sub {
Link Here
|
706 |
}; |
706 |
}; |
707 |
|
707 |
|
708 |
subtest 'checkout() tests' => sub { |
708 |
subtest 'checkout() tests' => sub { |
709 |
plan tests => 6; |
709 |
plan tests => 7; |
710 |
|
710 |
|
711 |
$schema->storage->txn_begin; |
711 |
$schema->storage->txn_begin; |
712 |
|
712 |
|
Lines 718-731
subtest 'checkout() tests' => sub {
Link Here
|
718 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); |
718 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); |
719 |
my $checkout = AddIssue( $patron, $item->barcode ); |
719 |
my $checkout = AddIssue( $patron, $item->barcode ); |
720 |
|
720 |
|
721 |
my $line = $account->add_debit({ |
721 |
my $line = $account->add_debit( |
722 |
amount => 10, |
722 |
{ |
723 |
interface => 'commandline', |
723 |
amount => 10, |
724 |
item_id => $item->itemnumber, |
724 |
interface => 'commandline', |
725 |
issue_id => $checkout->issue_id, |
725 |
item_id => $item->itemnumber, |
726 |
type => 'OVERDUE', |
726 |
issue_id => $checkout->issue_id, |
727 |
status => 'UNRETURNED' |
727 |
old_issue_id => undef, |
728 |
}); |
728 |
type => 'OVERDUE', |
|
|
729 |
status => 'UNRETURNED' |
730 |
} |
731 |
); |
729 |
|
732 |
|
730 |
my $line_checkout = $line->checkout; |
733 |
my $line_checkout = $line->checkout; |
731 |
is( ref($line_checkout), 'Koha::Checkout', 'Result type is correct' ); |
734 |
is( ref($line_checkout), 'Koha::Checkout', 'Result type is correct' ); |
Lines 743-751
subtest 'checkout() tests' => sub {
Link Here
|
743 |
is( ref($old_line_checkout), 'Koha::Old::Checkout', 'Result type is correct' ); |
746 |
is( ref($old_line_checkout), 'Koha::Old::Checkout', 'Result type is correct' ); |
744 |
is( $old_line_checkout->issue_id, $old_checkout->issue_id, 'Koha::Account::Line->checkout should return the correct old_checkout' ); |
747 |
is( $old_line_checkout->issue_id, $old_checkout->issue_id, 'Koha::Account::Line->checkout should return the correct old_checkout' ); |
745 |
|
748 |
|
746 |
$line->issue_id(undef)->store; |
749 |
$old_line_checkout->delete; |
|
|
750 |
$line->discard_changes; #NOTE: discard_changes refreshes the whole resultset, get_from_storage only refreshes the unjoined row |
747 |
is( $line->checkout, undef, 'Koha::Account::Line->checkout should return undef if no checkout linked' ); |
751 |
is( $line->checkout, undef, 'Koha::Account::Line->checkout should return undef if no checkout linked' ); |
748 |
|
752 |
|
|
|
753 |
$line->old_issue_id(undef)->store; |
754 |
$line->discard_changes; #NOTE: discard_changes refreshes the whole resultset, get_from_storage only refreshes the unjoined row |
755 |
is( $line->checkout, undef, 'Koha::Account::Line->checkout should return undef if no checkout linked' ); |
756 |
|
757 |
|
749 |
$schema->storage->txn_rollback; |
758 |
$schema->storage->txn_rollback; |
750 |
}; |
759 |
}; |
751 |
|
760 |
|
752 |
- |
|
|