Bugzilla – Attachment 102763 Details for
Bug 25112
Koha::CirculationRules->set_rules should handle scopes per rule
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25112: Add a failing test for CirculationRules.t
Bug-25112-Add-a-failing-test-for-CirculationRulest.patch (text/plain), 3.47 KB, created by
Lari Taskula
on 2020-04-11 18:00:27 UTC
(
hide
)
Description:
Bug 25112: Add a failing test for CirculationRules.t
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2020-04-11 18:00:27 UTC
Size:
3.47 KB
patch
obsolete
>From f2e52afea8b8f6fa89cfd0754c3a76b75c5bd6c4 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Sat, 11 Apr 2020 17:49:31 +0000 >Subject: [PATCH] Bug 25112: Add a failing test for CirculationRules.t > >To reproduce the problem, do: >1. prove t/db_dependent/Koha/CirculationRules.t >2. Observe a failing test > >set_rule cannot set 'holdallowed' for a 'categorycode'! at > t/db_dependent/Koha/CirculationRules.t line 304. > >Sponsored-by: The National Library of Finland >--- > t/db_dependent/Koha/CirculationRules.t | 68 +++++++++++++++++++++++++- > 1 file changed, 67 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/CirculationRules.t b/t/db_dependent/Koha/CirculationRules.t >index 7e27b59feb..202ca64ddb 100644 >--- a/t/db_dependent/Koha/CirculationRules.t >+++ b/t/db_dependent/Koha/CirculationRules.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use Test::Exception; > > use Koha::CirculationRules; >@@ -282,3 +282,69 @@ subtest 'get_onshelfholds_policy() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'set_rules() tests' => sub { >+ plan tests => 1; >+ >+ subtest 'scope validation' => sub { >+ plan tests => 6; >+ >+ $schema->storage->txn_begin; >+ >+ my $categorycode = $builder->build_object( { >+ class => 'Koha::Patron::Categories' } )->categorycode; >+ my $itemtype = $builder->build_object( { >+ class => 'Koha::ItemTypes' } )->itemtype; >+ my $branchcode = $builder->build_object( { >+ class => 'Koha::Libraries' } )->branchcode; >+ >+ my $rule; >+ Koha::CirculationRules->delete; >+ >+ is( scalar @{Koha::CirculationRules->set_rules( { >+ branchcode => $branchcode, >+ categorycode => $categorycode, >+ itemtype => $itemtype, >+ rules => { >+ refund => 1, >+ patron_maxissueqty => 2, >+ holdallowed => 3, >+ article_requests => 4, >+ maxissueqty => 5, >+ } >+ } )}, 5, 'All rules added' ); >+ >+ is( Koha::CirculationRules->get_effective_rule( { >+ branchcode => $branchcode, >+ rule_name => 'refund' >+ } )->rule_value, 1, 'Found rule refund' ); >+ >+ is( Koha::CirculationRules->get_effective_rule( { >+ branchcode => $branchcode, >+ categorycode => $categorycode, >+ rule_name => 'patron_maxissueqty' >+ } )->rule_value, 2, 'Found rule patron_maxissueqty' ); >+ >+ is( Koha::CirculationRules->get_effective_rule( { >+ branchcode => $branchcode, >+ itemtype => $itemtype, >+ rule_name => 'holdallowed' >+ } )->rule_value, 3, 'Found rule holdallowed' ); >+ >+ is( Koha::CirculationRules->get_effective_rule( { >+ branchcode => $branchcode, >+ categorycode => $categorycode, >+ itemtype => $itemtype, >+ rule_name => 'article_requests' >+ } )->rule_value, 4, 'Found rule article_requests' ); >+ >+ is( Koha::CirculationRules->get_effective_rule( { >+ branchcode => $branchcode, >+ categorycode => $categorycode, >+ itemtype => $itemtype, >+ rule_name => 'maxissueqty' >+ } )->rule_value, 5, 'Found rule maxissueqty' ); >+ >+ $schema->storage->txn_rollback; >+ }; >+}; >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25112
:
102763
|
102764
|
105787
|
105788
|
107650
|
107651