Lines 83-88
is( Koha::Patrons->search->count, $nb_of_patrons + 2, 'The 2 patrons should have
Link Here
|
83 |
my $retrieved_patron_1 = Koha::Patrons->find( $new_patron_1->borrowernumber ); |
83 |
my $retrieved_patron_1 = Koha::Patrons->find( $new_patron_1->borrowernumber ); |
84 |
is( $retrieved_patron_1->cardnumber, $new_patron_1->cardnumber, 'Find a patron by borrowernumber should return the correct patron' ); |
84 |
is( $retrieved_patron_1->cardnumber, $new_patron_1->cardnumber, 'Find a patron by borrowernumber should return the correct patron' ); |
85 |
|
85 |
|
|
|
86 |
|
87 |
|
86 |
subtest 'library' => sub { |
88 |
subtest 'library' => sub { |
87 |
plan tests => 2; |
89 |
plan tests => 2; |
88 |
is( $retrieved_patron_1->library->branchcode, $library->{branchcode}, 'Koha::Patron->library should return the correct library' ); |
90 |
is( $retrieved_patron_1->library->branchcode, $library->{branchcode}, 'Koha::Patron->library should return the correct library' ); |
Lines 1343-1364
subtest
Link Here
|
1343 |
|
1345 |
|
1344 |
# Pfiou, we can start now! |
1346 |
# Pfiou, we can start now! |
1345 |
subtest 'libraries_where_can_see_things' => sub { |
1347 |
subtest 'libraries_where_can_see_things' => sub { |
1346 |
plan tests => 2; |
1348 |
plan tests => 4; |
1347 |
t::lib::Mocks::mock_userenv( { patron => $patron_11_2 } ); |
1349 |
t::lib::Mocks::mock_userenv( { patron => $patron_11_1 } ); |
1348 |
my $params = { |
1350 |
my $params = { |
1349 |
permission => 'editcatalogue', |
1351 |
permission => 'borrowers', |
1350 |
subpermission => 'edit_any_item', |
1352 |
subpermission => 'view_borrower_infos_from_any_libraries', |
1351 |
group_feature => 'ft_limit_item_editing', |
1353 |
group_feature => 'ft_hide_patron_info', |
1352 |
}; |
1354 |
}; |
1353 |
my @branchcodes = $patron_11_2->libraries_where_can_see_things($params); |
1355 |
my @branchcodes = $patron_11_1->libraries_where_can_see_things($params); |
1354 |
is_deeply( |
1356 |
is_deeply( |
1355 |
\@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ], |
1357 |
\@branchcodes, [ ], |
1356 |
q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| |
1358 |
q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| |
1357 |
); |
1359 |
); |
|
|
1360 |
@branchcodes = $patron_11_1->libraries_where_can_see_things($params); |
1361 |
is_deeply( |
1362 |
\@branchcodes, [ ], |
1363 |
q|confirming second/cached request is the same patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| |
1364 |
); |
1365 |
|
1358 |
@branchcodes = $patron_11_2->libraries_where_can_see_things($params); |
1366 |
@branchcodes = $patron_11_2->libraries_where_can_see_things($params); |
1359 |
is_deeply( |
1367 |
is_deeply( |
1360 |
\@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ], |
1368 |
\@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ], |
1361 |
q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| |
1369 |
q|patron_11_2 can only view from group| |
|
|
1370 |
); |
1371 |
@branchcodes = $patron_11_2->libraries_where_can_see_things($params); |
1372 |
is_deeply( |
1373 |
\@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ], |
1374 |
q|confirming second/cached request is the same patron_11_2 can only view from group| |
1362 |
); |
1375 |
); |
1363 |
}; |
1376 |
}; |
1364 |
|
1377 |
|
Lines 1378-1384
subtest
Link Here
|
1378 |
$patron_11_2->can_edit_items_from( $library_21->branchcode ), |
1391 |
$patron_11_2->can_edit_items_from( $library_21->branchcode ), |
1379 |
"We can edit an item from outside our group as the group does not limit item editing" |
1392 |
"We can edit an item from outside our group as the group does not limit item editing" |
1380 |
); |
1393 |
); |
1381 |
$group_2->ft_limit_item_editing(1)->store(); |
1394 |
$group_1->ft_limit_item_editing(1)->store(); |
1382 |
|
1395 |
|
1383 |
$patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); |
1396 |
$patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); |
1384 |
#FIXME We refetch the patron because library lists are cached in an extra hash key |
1397 |
#FIXME We refetch the patron because library lists are cached in an extra hash key |
1385 |
- |
|
|