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 1365-1386
subtest
Link Here
|
1365 |
|
1367 |
|
1366 |
# Pfiou, we can start now! |
1368 |
# Pfiou, we can start now! |
1367 |
subtest 'libraries_where_can_see_things' => sub { |
1369 |
subtest 'libraries_where_can_see_things' => sub { |
1368 |
plan tests => 2; |
1370 |
plan tests => 4; |
1369 |
t::lib::Mocks::mock_userenv( { patron => $patron_11_2 } ); |
1371 |
t::lib::Mocks::mock_userenv( { patron => $patron_11_1 } ); |
1370 |
my $params = { |
1372 |
my $params = { |
1371 |
permission => 'editcatalogue', |
1373 |
permission => 'borrowers', |
1372 |
subpermission => 'edit_any_item', |
1374 |
subpermission => 'view_borrower_infos_from_any_libraries', |
1373 |
group_feature => 'ft_limit_item_editing', |
1375 |
group_feature => 'ft_hide_patron_info', |
1374 |
}; |
1376 |
}; |
1375 |
my @branchcodes = $patron_11_2->libraries_where_can_see_things($params); |
1377 |
my @branchcodes = $patron_11_1->libraries_where_can_see_things($params); |
1376 |
is_deeply( |
1378 |
is_deeply( |
1377 |
\@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ], |
1379 |
\@branchcodes, [ ], |
1378 |
q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| |
1380 |
q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| |
1379 |
); |
1381 |
); |
|
|
1382 |
@branchcodes = $patron_11_1->libraries_where_can_see_things($params); |
1383 |
is_deeply( |
1384 |
\@branchcodes, [ ], |
1385 |
q|confirming second/cached request is the same patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| |
1386 |
); |
1387 |
|
1380 |
@branchcodes = $patron_11_2->libraries_where_can_see_things($params); |
1388 |
@branchcodes = $patron_11_2->libraries_where_can_see_things($params); |
1381 |
is_deeply( |
1389 |
is_deeply( |
1382 |
\@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ], |
1390 |
\@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ], |
1383 |
q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| |
1391 |
q|patron_11_2 can only view from group| |
|
|
1392 |
); |
1393 |
@branchcodes = $patron_11_2->libraries_where_can_see_things($params); |
1394 |
is_deeply( |
1395 |
\@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ], |
1396 |
q|confirming second/cached request is the same patron_11_2 can only view from group| |
1384 |
); |
1397 |
); |
1385 |
}; |
1398 |
}; |
1386 |
|
1399 |
|
Lines 1400-1406
subtest
Link Here
|
1400 |
$patron_11_2->can_edit_items_from( $library_21->branchcode ), |
1413 |
$patron_11_2->can_edit_items_from( $library_21->branchcode ), |
1401 |
"We can edit an item from outside our group as the group does not limit item editing" |
1414 |
"We can edit an item from outside our group as the group does not limit item editing" |
1402 |
); |
1415 |
); |
1403 |
$group_2->ft_limit_item_editing(1)->store(); |
1416 |
$group_1->ft_limit_item_editing(1)->store(); |
1404 |
|
1417 |
|
1405 |
$patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); |
1418 |
$patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); |
1406 |
#FIXME We refetch the patron because library lists are cached in an extra hash key |
1419 |
#FIXME We refetch the patron because library lists are cached in an extra hash key |
1407 |
- |
|
|