Bugzilla – Attachment 165417 Details for
Bug 34597
Expired patrons can still place ILL requests through OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34597: Add tests
Bug-34597-Add-tests.patch (text/plain), 3.26 KB, created by
Pedro Amorim
on 2024-04-23 16:18:53 UTC
(
hide
)
Description:
Bug 34597: Add tests
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-04-23 16:18:53 UTC
Size:
3.26 KB
patch
obsolete
>From 53d71f9035fbec7aee68e87941d7fc9bba0800ba Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 28 Mar 2024 11:28:04 +0000 >Subject: [PATCH] Bug 34597: Add tests > >prove t/db_dependent/Koha/Illrequest.t >prove t/db_dependent/Koha/Patron/Categories.t >--- > t/db_dependent/Koha/ILL/Request.t | 22 ++++++++++++++++++++-- > t/db_dependent/Koha/Patron/Categories.t | 5 +++-- > 2 files changed, 23 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Koha/ILL/Request.t b/t/db_dependent/Koha/ILL/Request.t >index 5f4de8a9938..2ec832949e4 100755 >--- a/t/db_dependent/Koha/ILL/Request.t >+++ b/t/db_dependent/Koha/ILL/Request.t >@@ -20,6 +20,7 @@ > use Modern::Perl; > > use Test::More tests => 3; >+use Test::MockModule; > > use Koha::ILL::Requests; > >@@ -30,11 +31,20 @@ my $schema = Koha::Database->new->schema; > > subtest 'patron() tests' => sub { > >- plan tests => 3; >+ plan tests => 5; > > $schema->storage->txn_begin; > >- my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $patron_module = Test::MockModule->new('Koha::Patron'); >+ >+ my $patroncategory = $builder->build_object( >+ { >+ class => 'Koha::Patron::Categories', >+ value => { can_place_ill_in_opac => 1, BlockExpiredPatronOpacActions => 'ill_request' } >+ } >+ ); >+ my $patron = >+ $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patroncategory->id } } ); > my $request = > $builder->build_object( { class => 'Koha::ILL::Requests', value => { borrowernumber => $patron->id } } ); > >@@ -46,6 +56,14 @@ subtest 'patron() tests' => sub { > > is( $request->patron, undef ); > >+ # patron is not expired, is allowed >+ $patron_module->mock( 'is_expired', sub { return 0; } ); >+ is( $request->can_patron_place_ill_in_opac($patron), 1 ); >+ >+ # patron is expired, is not allowed >+ $patron_module->mock( 'is_expired', sub { return 1; } ); >+ is( $request->can_patron_place_ill_in_opac($patron), 0 ); >+ > $schema->storage->txn_rollback; > }; > >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index b0c13d38a6a..4bee746332a 100755 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -103,8 +103,8 @@ subtest 'get_expiry_date' => sub { > }; > > subtest 'BlockExpiredPatronOpacActions' => sub { >- plan tests => 3; >- t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 'hold'); >+ plan tests => 4; >+ t::lib::Mocks::mock_preference( 'BlockExpiredPatronOpacActions', 'hold,ill_request' ); > my $category = Koha::Patron::Category->new({ > categorycode => 'ya_cat', > category_type => 'A', >@@ -113,6 +113,7 @@ subtest 'BlockExpiredPatronOpacActions' => sub { > BlockExpiredPatronOpacActions => 'follow_syspref_BlockExpiredPatronOpacActions', > })->store; > is( $category->effective_BlockExpiredPatronOpacActions_contains('hold'), 1 ); >+ is( $category->effective_BlockExpiredPatronOpacActions_contains('ill_request'), 1 ); > is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), undef ); > $category->BlockExpiredPatronOpacActions('renew')->store; > is( $category->effective_BlockExpiredPatronOpacActions_contains('renew'), 1 ); >-- >2.39.2
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 34597
:
164052
|
164053
|
164054
|
164055
|
165415
|
165416
|
165417
|
165418
|
166563
|
166564
|
166668
|
166669
|
166670
|
166671
|
166672
|
167481
|
167482
|
167483
|
167484
|
167485
|
167486