From 9a30aa8f53ccf3a05c1833c88f05abbce49b479b Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 19 Nov 2019 13:22:18 -0300 Subject: [PATCH] Bug 23634: Add tests for is_superlibrarian Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy Signed-off-by: Lucas Gass (cherry picked from commit 8c8b23c42786463ce7eb617e5a22bf84e6635f1c) --- t/db_dependent/Koha/Patron.t | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index 3548e8ca78..6cf5160cbf 100644 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -193,21 +193,25 @@ subtest 'to_api() tests' => sub { $schema->storage->txn_rollback; }; -subtest 'login_attempts tests' => sub { - plan tests => 1; +subtest 'is_superlibrarian() tests' => sub { + + plan tests => 2; $schema->storage->txn_begin; my $patron = $builder->build_object( { class => 'Koha::Patrons', + value => { + flags => 16 + } } ); - my $patron_info = $patron->unblessed; - $patron->delete; - delete $patron_info->{login_attempts}; - my $new_patron = Koha::Patron->new($patron_info)->store; - is( $new_patron->discard_changes->login_attempts, 0, "login_attempts defaults to 0 as expected"); + + ok( !$patron->is_superlibrarian, 'Patron is not a superlibrarian and the method returns the correct value' ); + + $patron->flags(1)->store->discard_changes; + ok( $patron->is_superlibrarian, 'Patron is a superlibrarian and the method returns the correct value' ); $schema->storage->txn_rollback; }; -- 2.39.5