Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 4; |
20 |
use Test::More tests => 5; |
|
|
21 |
use t::lib::Mocks; |
21 |
use t::lib::TestBuilder; |
22 |
use t::lib::TestBuilder; |
22 |
|
23 |
|
23 |
use Koha::Patron::Categories; |
24 |
use Koha::Patron::Categories; |
Lines 57-59
is( Koha::Template::Plugin::Categories->GetName(
Link Here
|
57 |
|
58 |
|
58 |
$schema->storage->txn_rollback; |
59 |
$schema->storage->txn_rollback; |
59 |
|
60 |
|
60 |
- |
61 |
subtest 'can_any_reset_password() tests' => sub { |
|
|
62 |
|
63 |
plan tests => 3; |
64 |
|
65 |
$schema->storage->txn_begin; |
66 |
|
67 |
# Make sure all existing categories have reset_password set to 0 |
68 |
Koha::Patron::Categories->update({ reset_password => 0 }); |
69 |
|
70 |
ok( !Koha::Template::Plugin::Categories->new->can_any_reset_password, 'No category is allowed to reset password' ); |
71 |
|
72 |
t::lib::Mocks::mock_preference( 'OpacResetPassword', 0 ); |
73 |
|
74 |
my $category = $builder->build_object({ class => 'Koha::Patron::Categories', value => { reset_password => 1 } }); |
75 |
|
76 |
ok( Koha::Template::Plugin::Categories->new->can_any_reset_password, 'There\'s at least a category that is allowed to reset password' ); |
77 |
|
78 |
$category->reset_password( undef )->store; |
79 |
|
80 |
ok( !Koha::Template::Plugin::Categories->new->can_any_reset_password, 'No category is allowed to reset password' ); |
81 |
|
82 |
$schema->storage->txn_rollback; |
83 |
}; |
84 |
|