Lines 129-135
subtest 'update_password' => sub {
Link Here
|
129 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should not have logged' ); |
129 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should not have logged' ); |
130 |
}; |
130 |
}; |
131 |
|
131 |
|
132 |
subtest 'extend_subscription' => sub { |
132 |
subtest 'renew_account' => sub { |
133 |
plan tests => 6; |
133 |
plan tests => 6; |
134 |
my $a_month_ago = dt_from_string->add( months => -1 )->truncate( to => 'day' ); |
134 |
my $a_month_ago = dt_from_string->add( months => -1 )->truncate( to => 'day' ); |
135 |
my $a_year_later = dt_from_string->add( months => 12 )->truncate( to => 'day' ); |
135 |
my $a_year_later = dt_from_string->add( months => 12 )->truncate( to => 'day' ); |
Lines 154-174
subtest 'extend_subscription' => sub {
Link Here
|
154 |
|
154 |
|
155 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'dateexpiry' ); |
155 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'dateexpiry' ); |
156 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); |
156 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); |
157 |
my $expiry_date = $retrieved_patron->extend_subscription; |
157 |
my $expiry_date = $retrieved_patron->renew_account; |
158 |
is( $expiry_date, $a_year_later_minus_a_month, ); |
158 |
is( $expiry_date, $a_year_later_minus_a_month, ); |
159 |
my $retrieved_expiry_date = Koha::Patrons->find( $patron->{borrowernumber} )->dateexpiry; |
159 |
my $retrieved_expiry_date = Koha::Patrons->find( $patron->{borrowernumber} )->dateexpiry; |
160 |
is( dt_from_string($retrieved_expiry_date), $a_year_later_minus_a_month ); |
160 |
is( dt_from_string($retrieved_expiry_date), $a_year_later_minus_a_month ); |
161 |
my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
161 |
my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
162 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->extend_subscription should have logged' ); |
162 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->renew_account should have logged' ); |
163 |
|
163 |
|
164 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' ); |
164 |
t::lib::Mocks::mock_preference( 'BorrowerRenewalPeriodBase', 'now' ); |
165 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); |
165 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); |
166 |
$expiry_date = $retrieved_patron->extend_subscription; |
166 |
$expiry_date = $retrieved_patron->renew_account; |
167 |
is( $expiry_date, $a_year_later, ); |
167 |
is( $expiry_date, $a_year_later, ); |
168 |
$retrieved_expiry_date = Koha::Patrons->find( $patron->{borrowernumber} )->dateexpiry; |
168 |
$retrieved_expiry_date = Koha::Patrons->find( $patron->{borrowernumber} )->dateexpiry; |
169 |
is( dt_from_string($retrieved_expiry_date), $a_year_later ); |
169 |
is( dt_from_string($retrieved_expiry_date), $a_year_later ); |
170 |
$number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
170 |
$number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'RENEW', object => $retrieved_patron->borrowernumber } )->count; |
171 |
is( $number_of_logs, 1, 'Without BorrowerLogs, Koha::Patron->extend_subscription should not have logged' ); |
171 |
is( $number_of_logs, 1, 'Without BorrowerLogs, Koha::Patron->renew_account should not have logged' ); |
172 |
|
172 |
|
173 |
$retrieved_patron->delete; |
173 |
$retrieved_patron->delete; |
174 |
}; |
174 |
}; |
175 |
- |
|
|