diff --git a/t/db_dependent/Virtualshelves.t b/t/db_dependent/Virtualshelves.t index 1df952df22..10182dfbc5 100755 --- a/t/db_dependent/Virtualshelves.t +++ b/t/db_dependent/Virtualshelves.t @@ -1355,7 +1355,7 @@ subtest 'Get shelves containing biblios' => sub { }; subtest 'cannot_be_transferred' => sub { - plan tests => 12; + plan tests => 13; # Three patrons and a deleted one my $staff = $builder->build_object( { class => 'Koha::Patrons', value => { flags => undef } } ); @@ -1379,6 +1379,24 @@ subtest 'cannot_be_transferred' => sub { $public_list->cannot_be_transferred( { by => $staff->id, to => $receiver->id } ), 'unauthorized_transfer', 'Lacks permission' ); + + # Give recipient MINIMUM permission + $builder->build( + { + source => 'UserPermission', + value => { + borrowernumber => $receiver->id, + module_bit => 20, + code => 'edit_public_list_contents', + } + } + ); + is( + $public_list->cannot_be_transferred( { by => $staff->id, to => $receiver->id } ), + 'unauthorized_transfer', + 'Recipient lacks necessary permissions to own public list' + ); + my $perms = $builder->build( { source => 'UserPermission', @@ -1387,9 +1405,11 @@ subtest 'cannot_be_transferred' => sub { } } ); + is( - $public_list->cannot_be_transferred( { by => $staff->id, to => $receiver->id } ), 0, - 'Minimum permission passes' + $public_list->cannot_be_transferred( { by => $staff->id, to => $receiver->id } ), + 0, + 'Recipient with minimum required permission can accept ownership' ); $staff->flags(1)->store; is(