|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 7; |
22 |
use Test::More tests => 8; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
| 24 |
use Test::Warn; |
24 |
use Test::Warn; |
| 25 |
|
25 |
|
|
Lines 662-664
subtest 'extended_attributes' => sub {
Link Here
|
| 662 |
|
662 |
|
| 663 |
$schema->storage->txn_rollback; |
663 |
$schema->storage->txn_rollback; |
| 664 |
}; |
664 |
}; |
| 665 |
- |
665 |
|
|
|
666 |
subtest 'can_log_into() tests' => sub { |
| 667 |
|
| 668 |
plan tests => 5; |
| 669 |
|
| 670 |
$schema->storage->txn_begin; |
| 671 |
|
| 672 |
my $patron = $builder->build_object( |
| 673 |
{ |
| 674 |
class => 'Koha::Patrons', |
| 675 |
value => { |
| 676 |
flags => undef |
| 677 |
} |
| 678 |
} |
| 679 |
); |
| 680 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
| 681 |
|
| 682 |
t::lib::Mocks::mock_preference('IndependentBranches', 1); |
| 683 |
|
| 684 |
ok( $patron->can_log_into( $patron->library ), 'Patron can log into its own library' ); |
| 685 |
ok( !$patron->can_log_into( $library ), 'Patron cannot log into different library, IndependentBranches on' ); |
| 686 |
|
| 687 |
# make it a superlibrarian |
| 688 |
$patron->set({ flags => 1 })->store->discard_changes; |
| 689 |
ok( $patron->can_log_into( $library ), 'Superlibrarian can log into different library, IndependentBranches on' ); |
| 690 |
|
| 691 |
t::lib::Mocks::mock_preference('IndependentBranches', 0); |
| 692 |
|
| 693 |
# No special permissions |
| 694 |
$patron->set({ flags => undef })->store->discard_changes; |
| 695 |
ok( $patron->can_log_into( $patron->library ), 'Patron can log into its own library' ); |
| 696 |
ok( $patron->can_log_into( $library ), 'Patron can log into any library' ); |
| 697 |
|
| 698 |
$schema->storage->txn_rollback; |
| 699 |
}; |