Bug 23634: Add tests for is_superlibrarian

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2019-11-19 13:22:18 -03:00 committed by Jonathan Druart
parent 2056ab52bb
commit 312cd6dfd2
1 changed files with 25 additions and 1 deletions

View File

@ -19,7 +19,7 @@
use Modern::Perl;
use Test::More tests => 4;
use Test::More tests => 5;
use Test::Exception;
use Koha::Database;
@ -211,3 +211,27 @@ subtest 'login_attempts 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;
};