|
Lines 1051-1058
subtest 'Koha::Account::Line::apply() handles lost items' => sub {
Link Here
|
| 1051 |
$schema->storage->txn_rollback; |
1051 |
$schema->storage->txn_rollback; |
| 1052 |
}; |
1052 |
}; |
| 1053 |
|
1053 |
|
| 1054 |
subtest 'Koha::Account::pay() generates credit number' => sub { |
1054 |
subtest 'Koha::Account::pay() generates credit number (Koha::Account::Line->store)' => sub { |
| 1055 |
plan tests => 37; |
1055 |
plan tests => 38; |
| 1056 |
|
1056 |
|
| 1057 |
$schema->storage->txn_begin; |
1057 |
$schema->storage->txn_begin; |
| 1058 |
|
1058 |
|
|
Lines 1062-1067
subtest 'Koha::Account::pay() generates credit number' => sub {
Link Here
|
| 1062 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
1062 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 1063 |
my $account = $patron->account; |
1063 |
my $account = $patron->account; |
| 1064 |
|
1064 |
|
|
|
1065 |
#t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); |
| 1065 |
my $context = Test::MockModule->new('C4::Context'); |
1066 |
my $context = Test::MockModule->new('C4::Context'); |
| 1066 |
$context->mock( 'userenv', { branch => $library->id } ); |
1067 |
$context->mock( 'userenv', { branch => $library->id } ); |
| 1067 |
|
1068 |
|
|
Lines 1109-1113
subtest 'Koha::Account::pay() generates credit number' => sub {
Link Here
|
| 1109 |
$accountline = Koha::Account::Lines->find($accountlines_id); |
1110 |
$accountline = Koha::Account::Lines->find($accountlines_id); |
| 1110 |
is($accountline->credit_number, undef); |
1111 |
is($accountline->credit_number, undef); |
| 1111 |
|
1112 |
|
|
|
1113 |
throws_ok { |
| 1114 |
Koha::Account::Line->new( |
| 1115 |
{ |
| 1116 |
credit_type_code => $credit_type->code, |
| 1117 |
credit_number => 42 |
| 1118 |
} |
| 1119 |
)->store; |
| 1120 |
} |
| 1121 |
qr/AutoCreditNumber is enabled but credit_number is already defined!/, |
| 1122 |
'Croaked on bad call to store'; |
| 1123 |
|
| 1112 |
$schema->storage->txn_rollback; |
1124 |
$schema->storage->txn_rollback; |
| 1113 |
}; |
1125 |
}; |
| 1114 |
- |
|
|