From 4edc53078b3cbf36c3ba6c63e3c21451a936bb25 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 9 Jan 2020 13:55:58 +0100 Subject: [PATCH] Bug 24379: Fix the test First we create a patron using TestBuilder to get a hashref of valid info. Then we delete it and create a new patron using Koha::Patron->new Once stored, we should call discard_changes to make the calculated values available in the currenct object. --- t/db_dependent/Koha/Patron.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index a8fee982a9..7d5c8574e7 100644 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -166,9 +166,10 @@ subtest 'login_attempts tests' => sub { } ); my $patron_info = $patron->unblessed; + $patron->delete; delete $patron_info->{login_attempts}; - my $new_patron = Koha::Patron->new($patron_info); - is( $new_patron->login_attempts, 0, "login_attempts defaults to 0 as expected"); + my $new_patron = Koha::Patron->new($patron_info)->store; + is( $new_patron->discard_changes->login_attempts, 0, "login_attempts defaults to 0 as expected"); $schema->storage->txn_rollback; }; -- 2.11.0