From f3ad14d8133bf1376b49dd64d30e5347de480033 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 3 Oct 2022 18:27:21 +0000 Subject: [PATCH] Bug 26648: Add tests --- t/db_dependent/Koha/Old/Checkout.t | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Old/Checkout.t b/t/db_dependent/Koha/Old/Checkout.t index a5c8f0c38d..7cf520e96f 100755 --- a/t/db_dependent/Koha/Old/Checkout.t +++ b/t/db_dependent/Koha/Old/Checkout.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; use Test::Exception; use Koha::Database; @@ -80,3 +80,27 @@ subtest 'anonymize() tests' => sub { $schema->storage->txn_rollback; }; + +subtest 'deleteitem() tests' => sub { + + plan tests => 1; + + $schema->storage->txn_begin; + + my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); + + my $checkout_3 = $builder->build_object( + { + class => 'Koha::Old::Checkouts', + value => { borrowernumber => $patron->id } + } + ); + + # delete first checkout + my $item_to_del = $checkout_3->item; + $item_to_del->delete; + $checkout_3->discard_changes(); + is( $checkout_3->item, undef, "Item is deleted"); + + $schema->storage->txn_rollback; +}; -- 2.30.2