From fc74af8d709b6f8a551dca2c281eb824d5596f62 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 Content-Type: text/plain; charset=utf-8 Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy --- t/db_dependent/Koha/Patron.t | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index 63b77c1573..6cf5160cbf 100644 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 3; +use Test::More tests => 4; use Test::Exception; use Koha::Database; @@ -192,3 +192,26 @@ subtest 'to_api() tests' => sub { $schema->storage->txn_rollback; }; + +subtest 'is_superlibrarian() tests' => sub { + + plan tests => 2; + + $schema->storage->txn_begin; + + my $patron = $builder->build_object( + { + class => 'Koha::Patrons', + value => { + flags => 16 + } + } + ); + + 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.11.0