Bug 26648: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Cab Vinton <director@plaistowlibrary.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit c6fc76f478)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2022-10-03 18:27:21 +00:00
parent 9ecdebb966
commit 0dee72d97a

View file

@ -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;
};