|
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 996-998
subtest 'messages() and add_message() tests' => sub {
Link Here
|
| 996 |
|
996 |
|
| 997 |
$schema->storage->txn_rollback; |
997 |
$schema->storage->txn_rollback; |
| 998 |
}; |
998 |
}; |
| 999 |
- |
999 |
|
|
|
1000 |
subtest 'accessible() tests' => sub { |
| 1001 |
|
| 1002 |
plan tests => 2; |
| 1003 |
|
| 1004 |
$schema->storage->txn_begin; |
| 1005 |
|
| 1006 |
my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 1007 |
my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 1008 |
|
| 1009 |
my $patron = $builder->build_object( |
| 1010 |
{ |
| 1011 |
class => 'Koha::Patrons', |
| 1012 |
value => { |
| 1013 |
flags => 2**2, # only has catalogue permissions |
| 1014 |
branchcode => $library_1->id |
| 1015 |
} |
| 1016 |
} |
| 1017 |
); |
| 1018 |
|
| 1019 |
my $patron_1 = $builder->build_object( |
| 1020 |
{ class => 'Koha::Patrons', value => { branchcode => $library_1->id } } |
| 1021 |
); |
| 1022 |
my $patron_2 = $builder->build_object( |
| 1023 |
{ class => 'Koha::Patrons', value => { branchcode => $library_2->id } } |
| 1024 |
); |
| 1025 |
|
| 1026 |
t::lib::Mocks::mock_userenv( { patron => $patron } ); |
| 1027 |
|
| 1028 |
ok( $patron_1->accessible, 'Has access to the patron' ); |
| 1029 |
ok( !$patron_2->accessible, 'Does not have access to the patron' ); |
| 1030 |
|
| 1031 |
$schema->storage->txn_rollback; |
| 1032 |
}; |