|
Lines 180-186
subtest 'add_credit() tests' => sub {
Link Here
|
| 180 |
description => 'Payment of 25', |
180 |
description => 'Payment of 25', |
| 181 |
library_id => $patron->branchcode, |
181 |
library_id => $patron->branchcode, |
| 182 |
note => 'not really important', |
182 |
note => 'not really important', |
| 183 |
type => 'payment', |
183 |
type => 'PAYMENT', |
| 184 |
user_id => $patron->id |
184 |
user_id => $patron->id |
| 185 |
} |
185 |
} |
| 186 |
); |
186 |
); |
|
Lines 192-198
subtest 'add_credit() tests' => sub {
Link Here
|
| 192 |
description => 'Payment of 25', |
192 |
description => 'Payment of 25', |
| 193 |
library_id => $patron->branchcode, |
193 |
library_id => $patron->branchcode, |
| 194 |
note => 'not really important', |
194 |
note => 'not really important', |
| 195 |
type => 'payment', |
195 |
type => 'PAYMENT', |
| 196 |
user_id => $patron->id, |
196 |
user_id => $patron->id, |
| 197 |
interface => 'commandline' |
197 |
interface => 'commandline' |
| 198 |
} |
198 |
} |
|
Lines 201-207
subtest 'add_credit() tests' => sub {
Link Here
|
| 201 |
is( $account->balance, -25, 'Patron has a balance of -25' ); |
201 |
is( $account->balance, -25, 'Patron has a balance of -25' ); |
| 202 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No log was added' ); |
202 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No log was added' ); |
| 203 |
is( $schema->resultset('Statistic')->count(), $statistics + 1, 'Action added to statistics' ); |
203 |
is( $schema->resultset('Statistic')->count(), $statistics + 1, 'Action added to statistics' ); |
| 204 |
is( $line_1->credit_type_code, $Koha::Account::account_type_credit->{'payment'}, 'Account type is correctly set' ); |
204 |
is( $line_1->credit_type_code, $Koha::Account::account_type_credit->{'PAYMENT'}, 'Account type is correctly set' ); |
| 205 |
|
205 |
|
| 206 |
# Enable logs |
206 |
# Enable logs |
| 207 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
207 |
t::lib::Mocks::mock_preference( 'FinesLog', 1 ); |
|
Lines 219-225
subtest 'add_credit() tests' => sub {
Link Here
|
| 219 |
is( $account->balance, -62, 'Patron has a balance of -25' ); |
219 |
is( $account->balance, -62, 'Patron has a balance of -25' ); |
| 220 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 1, 'Log was added' ); |
220 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 1, 'Log was added' ); |
| 221 |
is( $schema->resultset('Statistic')->count(), $statistics + 2, 'Action added to statistics' ); |
221 |
is( $schema->resultset('Statistic')->count(), $statistics + 2, 'Action added to statistics' ); |
| 222 |
is( $line_2->credit_type_code, $Koha::Account::account_type_credit->{'payment'}, 'Account type is correctly set' ); |
222 |
is( $line_2->credit_type_code, $Koha::Account::account_type_credit->{'PAYMENT'}, 'Account type is correctly set' ); |
| 223 |
|
223 |
|
| 224 |
# offsets have the credit_id set to accountlines_id, and debit_id is undef |
224 |
# offsets have the credit_id set to accountlines_id, and debit_id is undef |
| 225 |
my $offset_1 = Koha::Account::Offsets->search({ credit_id => $line_1->id })->next; |
225 |
my $offset_1 = Koha::Account::Offsets->search({ credit_id => $line_1->id })->next; |