Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 24; |
22 |
use Test::More tests => 25; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
use Test::Warn; |
24 |
use Test::Warn; |
25 |
|
25 |
|
Lines 30-36
use Koha::ArticleRequests;
Link Here
|
30 |
use Koha::Patrons; |
30 |
use Koha::Patrons; |
31 |
use Koha::Patron::Relationships; |
31 |
use Koha::Patron::Relationships; |
32 |
use C4::Circulation qw( AddIssue AddReturn ); |
32 |
use C4::Circulation qw( AddIssue AddReturn ); |
33 |
|
|
|
34 |
use t::lib::TestBuilder; |
33 |
use t::lib::TestBuilder; |
35 |
use t::lib::Mocks; |
34 |
use t::lib::Mocks; |
36 |
|
35 |
|
Lines 975-980
subtest 'password expiration tests' => sub {
Link Here
|
975 |
my $category = $builder->build_object({ class => 'Koha::Patron::Categories', value => { |
974 |
my $category = $builder->build_object({ class => 'Koha::Patron::Categories', value => { |
976 |
password_expiry_days => 10, |
975 |
password_expiry_days => 10, |
977 |
require_strong_password => 0, |
976 |
require_strong_password => 0, |
|
|
977 |
force_password_reset_when_set_by_staff => 0, |
978 |
} |
978 |
} |
979 |
}); |
979 |
}); |
980 |
my $patron = $builder->build_object({ class=> 'Koha::Patrons', value => { |
980 |
my $patron = $builder->build_object({ class=> 'Koha::Patrons', value => { |
Lines 1061-1066
subtest 'password expiration tests' => sub {
Link Here
|
1061 |
|
1061 |
|
1062 |
}; |
1062 |
}; |
1063 |
|
1063 |
|
|
|
1064 |
subtest 'force_password_reset_when_set_by_staff tests' => sub { |
1065 |
|
1066 |
plan tests => 3; |
1067 |
|
1068 |
$schema->storage->txn_begin; |
1069 |
|
1070 |
my $category = $builder->build_object({ |
1071 |
class => 'Koha::Patron::Categories', |
1072 |
value => { |
1073 |
force_password_reset_when_set_by_staff => 1, |
1074 |
require_strong_password => 0, |
1075 |
} |
1076 |
}); |
1077 |
|
1078 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { |
1079 |
categorycode => $category->categorycode, |
1080 |
password => 'hats' |
1081 |
} |
1082 |
}); |
1083 |
|
1084 |
$patron->delete()->store()->discard_changes(); |
1085 |
is( $patron->password_expired, 1, "Patron forced into changing password, password expired."); |
1086 |
|
1087 |
$patron->category->force_password_reset_when_set_by_staff(0)->store(); |
1088 |
$patron->delete()->store()->discard_changes(); |
1089 |
is( $patron->password_expired, 0, "Patron not forced into changing password, password not expired."); |
1090 |
|
1091 |
$patron->category->force_password_reset_when_set_by_staff(1)->store(); |
1092 |
t::lib::Mocks::mock_preference( 'PatronSelfRegistrationDefaultCategory', $patron->categorycode ); |
1093 |
$patron->delete()->store()->discard_changes(); |
1094 |
is( $patron->password_expired, 0, "Patron forced into changing password but patron is self registered, password not expired."); |
1095 |
|
1096 |
|
1097 |
$schema->storage->txn_rollback; |
1098 |
|
1099 |
}; |
1100 |
|
1064 |
subtest 'safe_to_delete() tests' => sub { |
1101 |
subtest 'safe_to_delete() tests' => sub { |
1065 |
|
1102 |
|
1066 |
plan tests => 14; |
1103 |
plan tests => 14; |