Bug 23634: Make is_superlibrarian return 1 or 0

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-09-03 10:20:32 +02:00
parent bc97867dfc
commit 72f4765e6f
2 changed files with 7 additions and 4 deletions

View File

@ -1371,7 +1371,7 @@ Return true if the patron is a superlibrarian.
sub is_superlibrarian {
my ($self) = @_;
return $self->has_permission( { superlibrarian => 1 } );
return $self->has_permission( { superlibrarian => 1 } ) ? 1 : 0;
}
=head3 is_adult

View File

@ -214,7 +214,7 @@ subtest 'login_attempts tests' => sub {
subtest 'is_superlibrarian() tests' => sub {
plan tests => 2;
plan tests => 3;
$schema->storage->txn_begin;
@ -228,10 +228,13 @@ subtest 'is_superlibrarian() tests' => sub {
}
);
ok( !$patron->is_superlibrarian, 'Patron is not a superlibrarian and the method returns the correct value' );
is( $patron->is_superlibrarian, 0, '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' );
is( $patron->is_superlibrarian, 1, 'Patron is a superlibrarian and the method returns the correct value' );
$patron->flags(0)->store->discard_changes;
is( $patron->is_superlibrarian, 0, 'Patron is not a superlibrarian and the method returns the correct value' );
$schema->storage->txn_rollback;
};