Bugzilla – Attachment 167477 Details for
Bug 36453
BlockExpiredPatronOpacActions should allow multiple actions options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36453: Update tests
Bug-36453-Update-tests.patch (text/plain), 8.71 KB, created by
Martin Renvoize (ashimema)
on 2024-06-05 16:09:03 UTC
(
hide
)
Description:
Bug 36453: Update tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-05 16:09:03 UTC
Size:
8.71 KB
patch
obsolete
>From 1ae5b851f4dcc8407b4ea46c81b4020dee140aea Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 28 Mar 2024 09:12:12 -0100 >Subject: [PATCH] Bug 36453: Update tests > >Address new new version of system pref >Address new version of categories DB table BlockExpiredPatronOpacActions column > >Test plan, k-t-d, BEFORE applying patch: >1) Edit some patron categories, visit: >/cgi-bin/koha/admin/categories.pl >2) Set different values for the "Block expired patrons" input config >Set a category to block >Set a category to don't block >Set a category to follow the syspref >3) Take note of the current value of the BlockExpiredPatronOpacActions sys pref > >Apply patch, then run the following commands >- koha-plack --restart kohadev >- yarn css:build >- run updatedatabase > >4) Visit the patron categories you edited before, make sure they all have the correct values for the new config type >5) Check the BlockExpiredPatronOpacActions sys pref and make sure the new value is correct according to what was before >6) Add a new patron of one of the above categories, test that: >If 'hold' is a blocked action, patron is unable to place a hold in OPAC >If 'renew' is a blocked action, patron is unable to renew in OPAC >If 'follow sys pref' is the option, check that a patron may place a hold or renew an item according to the BlockExpiredPatronOpacActions sys pref value > >prove t/db_dependent/Circulation.t >prove t/db_dependent/ILSDI_Services.t >prove t/db_dependent/Koha/Object.t >prove t/db_dependent/Koha/Patron/Categories.t > >Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Circulation.t | 18 +++++++++--------- > t/db_dependent/ILSDI_Services.t | 6 +++--- > t/db_dependent/Koha/Object.t | 2 +- > t/db_dependent/Koha/Patron/Categories.t | 13 +++++++------ > 4 files changed, 20 insertions(+), 19 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 24d5909d82c..d23db86b5e1 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -157,7 +157,7 @@ my $patron_category = $builder->build( > value => { > category_type => 'P', > enrolmentfee => 0, >- BlockExpiredPatronOpacActions => -1, # Pick the pref value >+ BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', > } > } > ); >@@ -1340,20 +1340,20 @@ subtest "CanBookBeRenewed tests" => sub { > my $ten_days_before = dt_from_string->add( days => -10 ); > my $ten_days_ahead = dt_from_string->add( days => 10 ); > >- # Patron is expired and BlockExpiredPatronOpacActions=0 >+ # Patron is expired and BlockExpiredPatronOpacActions='' > # => auto renew is allowed >- t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 0); >+ t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', ''); > my $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); > ( $renewokay, $error ) = > CanBookBeRenewed( $expired_borrower_obj, $issue ); > is( $renewokay, 1, 'Renew, even if renewal is automatic' ); >- is( $error, 'auto_renew', 'Can auto renew, patron is expired but BlockExpiredPatronOpacActions=0' ); >+ is( $error, 'auto_renew', 'Can auto renew, patron is expired but BlockExpiredPatronOpacActions=\'\'' ); > Koha::Checkouts->find( $issue->issue_id )->delete; > > >- # Patron is expired and BlockExpiredPatronOpacActions=1 >+ # Patron is expired and BlockExpiredPatronOpacActions='renew' > # => auto renew is not allowed >- t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); >+ t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'renew'); > $issue = AddIssue( $expired_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); > ( $renewokay, $error ) = > CanBookBeRenewed( $expired_borrower_obj, $issue ); >@@ -1363,12 +1363,12 @@ subtest "CanBookBeRenewed tests" => sub { > > # Patron is not expired and BlockExpiredPatronOpacActions=1 > # => auto renew is allowed >- t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); >+ t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'renew'); > $issue = AddIssue( $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, undef, { auto_renew => 1 } ); > ( $renewokay, $error ) = > CanBookBeRenewed( $renewing_borrower_obj, $issue ); > is( $renewokay, 1, 'Renew, even if renewal is automatic' ); >- is( $error, 'auto_renew', 'Can auto renew, BlockExpiredPatronOpacActions=1 but patron is not expired' ); >+ is( $error, 'auto_renew', 'Can auto renew, BlockExpiredPatronOpacActions=\'renew\' but patron is not expired' ); > $issue->delete; > }; > >@@ -1983,7 +1983,7 @@ subtest "AllowRenewalIfOtherItemsAvailable tests" => sub { > value => { > category_type => 'P', > enrolmentfee => 0, >- BlockExpiredPatronOpacActions => -1, # Pick the pref value >+ BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', > } > } > ); >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index 442f1c24022..c7e728a3fb8 100755 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -274,7 +274,7 @@ subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes > source => 'Category', > value => { > category_type => 'A', >- BlockExpiredPatronOpacActions => -1, >+ BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', > } > } ); > >@@ -584,7 +584,7 @@ subtest 'Holds test' => sub { > # Test Patron cannot reserve if expired and BlockExpiredPatronOpacActions > my $category = $builder->build({ > source => 'Category', >- value => { BlockExpiredPatronOpacActions => -1 } >+ value => { BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions' } > }); > > my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode }; >@@ -597,7 +597,7 @@ subtest 'Holds test' => sub { > dateexpiry => '2000-01-01', > })->store->borrowernumber; > >- t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1); >+ t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'hold,renew'); > > my $item5 = $builder->build({ > source => 'Item', >diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t >index 28ac6e5e94b..b1c6bb51728 100755 >--- a/t/db_dependent/Koha/Object.t >+++ b/t/db_dependent/Koha/Object.t >@@ -1049,7 +1049,7 @@ subtest 'unblessed_all_relateds' => sub { > value => { > category_type => 'P', > enrolmentfee => 0, >- BlockExpiredPatronOpacActions => -1, # Pick the pref value >+ BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', > } > } > ); >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index 6a7b8bcd6fc..b0c13d38a6a 100755 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -103,18 +103,19 @@ subtest 'get_expiry_date' => sub { > }; > > subtest 'BlockExpiredPatronOpacActions' => sub { >- plan tests => 2; >- t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 42); >+ plan tests => 3; >+ t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'hold'); > my $category = Koha::Patron::Category->new({ > categorycode => 'ya_cat', > category_type => 'A', > description => 'yacatdesc', > enrolmentperiod => undef, >- BlockExpiredPatronOpacActions => -1, >+ BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', > })->store; >- is( $category->effective_BlockExpiredPatronOpacActions, 42 ); >- $category->BlockExpiredPatronOpacActions(24)->store; >- is( $category->effective_BlockExpiredPatronOpacActions, 24 ); >+ is( $category->effective_BlockExpiredPatronOpacActions_contains('hold'), 1 ); >+ is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), undef ); >+ $category->BlockExpiredPatronOpacActions('renew')->store; >+ is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), 1 ); > $category->delete; > }; > >-- >2.45.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 36453
:
164042
|
164043
|
164044
|
164045
|
164046
|
164047
|
164048
|
164762
|
164763
|
164764
|
164765
|
164766
|
164767
|
164768
|
165413
|
165414
|
165454
|
167461
|
167462
|
167463
|
167464
|
167465
|
167466
|
167467
|
167468
|
167469
|
167470
|
167471
|
167472
|
167473
|
167474
|
167475
|
167476
| 167477 |
167478
|
167479
|
167480
|
168435
|
168436