Lines 1350-1360
subtest 'libraries_where_can_see_patrons + can_see_patron_infos + search_limited
Link Here
|
1350 |
plan tests => 6; |
1350 |
plan tests => 6; |
1351 |
|
1351 |
|
1352 |
t::lib::Mocks::mock_userenv({ patron => $patron_11_1 }); |
1352 |
t::lib::Mocks::mock_userenv({ patron => $patron_11_1 }); |
|
|
1353 |
$patron_11_1 = Koha::Patrons->find( $patron_11_1->borrowernumber ); |
1353 |
is( $patron_11_1->can_see_patron_infos( $patron_11_2 ), 1, q|patron_11_1 can see patron_11_2, from its library| ); |
1354 |
is( $patron_11_1->can_see_patron_infos( $patron_11_2 ), 1, q|patron_11_1 can see patron_11_2, from its library| ); |
1354 |
is( $patron_11_1->can_see_patron_infos( $patron_12 ), 1, q|patron_11_1 can see patron_12, from its group| ); |
1355 |
is( $patron_11_1->can_see_patron_infos( $patron_12 ), 1, q|patron_11_1 can see patron_12, from its group| ); |
1355 |
is( $patron_11_1->can_see_patron_infos( $patron_21 ), 1, q|patron_11_1 can see patron_11_2, from another group| ); |
1356 |
is( $patron_11_1->can_see_patron_infos( $patron_21 ), 1, q|patron_11_1 can see patron_11_2, from another group| ); |
1356 |
|
1357 |
|
1357 |
t::lib::Mocks::mock_userenv({ patron => $patron_11_2 }); |
1358 |
t::lib::Mocks::mock_userenv({ patron => $patron_11_2 }); |
|
|
1359 |
$patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); |
1358 |
is( $patron_11_2->can_see_patron_infos( $patron_11_1 ), 1, q|patron_11_2 can see patron_11_1, from its library| ); |
1360 |
is( $patron_11_2->can_see_patron_infos( $patron_11_1 ), 1, q|patron_11_2 can see patron_11_1, from its library| ); |
1359 |
is( $patron_11_2->can_see_patron_infos( $patron_12 ), 1, q|patron_11_2 can see patron_12, from its group| ); |
1361 |
is( $patron_11_2->can_see_patron_infos( $patron_12 ), 1, q|patron_11_2 can see patron_12, from its group| ); |
1360 |
is( $patron_11_2->can_see_patron_infos( $patron_21 ), 0, q|patron_11_2 can NOT see patron_21, from another group| ); |
1362 |
is( $patron_11_2->can_see_patron_infos( $patron_21 ), 0, q|patron_11_2 can NOT see patron_21, from another group| ); |
Lines 1363-1377
subtest 'libraries_where_can_see_patrons + can_see_patron_infos + search_limited
Link Here
|
1363 |
plan tests => 6; |
1365 |
plan tests => 6; |
1364 |
|
1366 |
|
1365 |
t::lib::Mocks::mock_userenv({ patron => $patron_11_1 }); |
1367 |
t::lib::Mocks::mock_userenv({ patron => $patron_11_1 }); |
|
|
1368 |
$patron_11_1 = Koha::Patrons->find( $patron_11_1->borrowernumber ); |
1366 |
my $total_number_of_patrons = $nb_of_patrons + 4; #we added four in these tests |
1369 |
my $total_number_of_patrons = $nb_of_patrons + 4; #we added four in these tests |
1367 |
is( Koha::Patrons->search->count, $total_number_of_patrons, 'Non-limited search should return all patrons' ); |
1370 |
is( Koha::Patrons->search->count, $total_number_of_patrons, 'Non-limited search should return all patrons' ); |
1368 |
is( Koha::Patrons->search_limited->count, $total_number_of_patrons, 'patron_11_1 is allowed to see all patrons' ); |
1371 |
is( Koha::Patrons->search_limited->count, $total_number_of_patrons, 'patron_11_1 is allowed to see all patrons' ); |
1369 |
|
1372 |
|
1370 |
t::lib::Mocks::mock_userenv({ patron => $patron_11_2 }); |
1373 |
t::lib::Mocks::mock_userenv({ patron => $patron_11_2 }); |
|
|
1374 |
$patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); |
1371 |
is( Koha::Patrons->search->count, $total_number_of_patrons, 'Non-limited search should return all patrons'); |
1375 |
is( Koha::Patrons->search->count, $total_number_of_patrons, 'Non-limited search should return all patrons'); |
1372 |
is( Koha::Patrons->search_limited->count, 3, 'patron_12_1 is not allowed to see patrons from other groups, only patron_11_1, patron_11_2 and patron_12' ); |
1376 |
is( Koha::Patrons->search_limited->count, 3, 'patron_12_1 is not allowed to see patrons from other groups, only patron_11_1, patron_11_2 and patron_12' ); |
1373 |
|
1377 |
|
1374 |
t::lib::Mocks::mock_userenv({ patron => $patron_21 }); |
1378 |
t::lib::Mocks::mock_userenv({ patron => $patron_21 }); |
|
|
1379 |
$patron_21 = Koha::Patrons->find( $patron_21->borrowernumber ); |
1375 |
is( Koha::Patrons->search->count, $total_number_of_patrons, 'Non-limited search should return all patrons'); |
1380 |
is( Koha::Patrons->search->count, $total_number_of_patrons, 'Non-limited search should return all patrons'); |
1376 |
is( Koha::Patrons->search_limited->count, 1, 'patron_21 is not allowed to see patrons from other groups, only himself' ); |
1381 |
is( Koha::Patrons->search_limited->count, 1, 'patron_21 is not allowed to see patrons from other groups, only himself' ); |
1377 |
}; |
1382 |
}; |
1378 |
- |
|
|