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:
parent
bc97867dfc
commit
72f4765e6f
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue