From 64260d452f3630d14fa34afc15f1dc4f6bf7b83c Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Mon, 19 Oct 2020 12:55:18 +0100 Subject: [PATCH] Bug 23916: (follow-up) Rebase unit tests This commit is a response to Katrin's comments in comment #62: - Fixed merge conflict It also fixes a test which now fails due to an upstream change in C4::Circulation Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Circulation.t | 2 +- t/db_dependent/Koha/Checkouts.t | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 104ed7cb7c2..41b10d23f6c 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -4603,7 +4603,7 @@ subtest 'Checkout should correctly terminate a transfer' => sub { $hold = $hold->get_from_storage; is( $hold->found, undef, 'Hold is waiting' ); is( $hold->priority, 1, ); -} +}; subtest 'AddIssue records staff who checked out item if appropriate' => sub { plan tests => 2; diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t index 0ee6a4d8b74..01c97bb5b63 100755 --- a/t/db_dependent/Koha/Checkouts.t +++ b/t/db_dependent/Koha/Checkouts.t @@ -94,6 +94,9 @@ subtest 'item' => sub { is( $item->itemnumber, $item_1->itemnumber, 'Koha::Checkout->item should return the correct item' ); }; +$retrieved_checkout_1->delete; +is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' ); + subtest 'patron' => sub { plan tests => 3; my $patron = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); @@ -127,7 +130,7 @@ subtest 'issuer' => sub { my $patron = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); my $issuer = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); - my $item = $builder->build_object( { class=> 'Koha::Items' } ); + my $item = $builder->build_sample_item; my $checkout = Koha::Checkout->new({ borrowernumber => $patron->borrowernumber, issuer => $issuer->borrowernumber, @@ -141,8 +144,9 @@ subtest 'issuer' => sub { is( $i->borrowernumber, $issuer->borrowernumber, 'Koha::Checkout->issued_by should return the correct patron' ); + # Testing Koha::Old::Checkout->patron now my $issue_id = $checkout->issue_id; - C4::Circulation::MarkIssueReturned( $i->borrowernumber, $checkout->itemnumber ); + C4::Circulation::MarkIssueReturned( $patron->borrowernumber, $checkout->itemnumber ); $i->delete; my $old_issue = Koha::Old::Checkouts->find($issue_id); is( $old_issue->issuer, undef, @@ -151,8 +155,5 @@ subtest 'issuer' => sub { }; -$retrieved_checkout_1->delete; -is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' ); - $schema->storage->txn_rollback; -- 2.29.2