Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 21; |
20 |
use Test::More tests => 22; |
21 |
use Test::Exception; |
21 |
use Test::Exception; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 1120-1122
subtest 'messages() and add_message() tests' => sub {
Link Here
|
1120 |
|
1120 |
|
1121 |
$schema->storage->txn_rollback; |
1121 |
$schema->storage->txn_rollback; |
1122 |
}; |
1122 |
}; |
1123 |
- |
1123 |
|
|
|
1124 |
subtest 'accessible() tests' => sub { |
1125 |
|
1126 |
plan tests => 2; |
1127 |
|
1128 |
$schema->storage->txn_begin; |
1129 |
|
1130 |
my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } ); |
1131 |
my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
1132 |
|
1133 |
my $patron = $builder->build_object( |
1134 |
{ |
1135 |
class => 'Koha::Patrons', |
1136 |
value => { |
1137 |
flags => 2**2, # only has catalogue permissions |
1138 |
branchcode => $library_1->id |
1139 |
} |
1140 |
} |
1141 |
); |
1142 |
|
1143 |
my $patron_1 = $builder->build_object( |
1144 |
{ class => 'Koha::Patrons', value => { branchcode => $library_1->id } } |
1145 |
); |
1146 |
my $patron_2 = $builder->build_object( |
1147 |
{ class => 'Koha::Patrons', value => { branchcode => $library_2->id } } |
1148 |
); |
1149 |
|
1150 |
t::lib::Mocks::mock_userenv( { patron => $patron } ); |
1151 |
|
1152 |
ok( $patron_1->accessible, 'Has access to the patron' ); |
1153 |
ok( !$patron_2->accessible, 'Does not have access to the patron' ); |
1154 |
|
1155 |
$schema->storage->txn_rollback; |
1156 |
}; |