|
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 |
use DateTime; |
23 |
use DateTime; |
|
Lines 1112-1114
subtest 'messages() and add_message() tests' => sub {
Link Here
|
| 1112 |
|
1112 |
|
| 1113 |
$schema->storage->txn_rollback; |
1113 |
$schema->storage->txn_rollback; |
| 1114 |
}; |
1114 |
}; |
| 1115 |
- |
1115 |
|
|
|
1116 |
subtest 'accessible() tests' => sub { |
| 1117 |
|
| 1118 |
plan tests => 2; |
| 1119 |
|
| 1120 |
$schema->storage->txn_begin; |
| 1121 |
|
| 1122 |
my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 1123 |
my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 1124 |
|
| 1125 |
my $patron = $builder->build_object( |
| 1126 |
{ |
| 1127 |
class => 'Koha::Patrons', |
| 1128 |
value => { |
| 1129 |
flags => 2**2, # only has catalogue permissions |
| 1130 |
branchcode => $library_1->id |
| 1131 |
} |
| 1132 |
} |
| 1133 |
); |
| 1134 |
|
| 1135 |
my $patron_1 = $builder->build_object( |
| 1136 |
{ class => 'Koha::Patrons', value => { branchcode => $library_1->id } } |
| 1137 |
); |
| 1138 |
my $patron_2 = $builder->build_object( |
| 1139 |
{ class => 'Koha::Patrons', value => { branchcode => $library_2->id } } |
| 1140 |
); |
| 1141 |
|
| 1142 |
t::lib::Mocks::mock_userenv( { patron => $patron } ); |
| 1143 |
|
| 1144 |
ok( $patron_1->accessible, 'Has access to the patron' ); |
| 1145 |
ok( !$patron_2->accessible, 'Does not have access to the patron' ); |
| 1146 |
|
| 1147 |
$schema->storage->txn_rollback; |
| 1148 |
}; |