diff --git a/t/db_dependent/Koha/CirculationRules.t b/t/db_dependent/Koha/CirculationRules.t index 18c8653523..7c8ec68cde 100755 --- a/t/db_dependent/Koha/CirculationRules.t +++ b/t/db_dependent/Koha/CirculationRules.t @@ -153,7 +153,7 @@ subtest 'get_effective_issuing_rule' => sub { }; subtest 'set_rule' => sub { - plan tests => 3; + plan tests => 4; $schema->storage->txn_begin; @@ -205,7 +205,7 @@ subtest 'set_rule' => sub { branchcode => $branchcode, categorycode => $categorycode, itemtype => $itemtype, - rule_name => 'fine', + rule_name => 'article_requests', rule_value => '', } ); }, 'setting fine with branch/category/itemtype succeeds' ); @@ -300,6 +300,30 @@ subtest 'set_rule' => sub { }, qr/categorycode/, 'setting holdallowed with categorycode fails' ); }; + subtest 'Call with badly formatted params' => sub { + plan tests => 4; + + Koha::CirculationRules->delete; + + foreach my $monetary_rule ( ( 'article_request_fee', 'fine', 'overduefinescap', 'recall_overdue_fine' ) ) { + throws_ok( + sub { + Koha::CirculationRules->set_rule( + { + categorycode => '*', + branchcode => '*', + ( $monetary_rule ne 'article_request_fee' ? ( itemtype => '*' ) : () ), + rule_name => $monetary_rule, + rule_value => '10,00', + } + ); + }, + qr/decimal/, + "setting $monetary_rule fails when passed value is not decimal" + ); + } + }; + $schema->storage->txn_rollback; };