Bugzilla – Attachment 156426 Details for
Bug 26053
Add styling to show expired patron restrictions as inactive
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26053: Add unit test for Koha::Patron::Restriction
Bug-26053-Add-unit-test-for-KohaPatronRestriction.patch (text/plain), 2.76 KB, created by
Fridolin Somers
on 2023-09-29 19:36:08 UTC
(
hide
)
Description:
Bug 26053: Add unit test for Koha::Patron::Restriction
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2023-09-29 19:36:08 UTC
Size:
2.76 KB
patch
obsolete
>From 8498be8562e44561f0f6d435d0294678e525d4fb Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 29 Sep 2023 09:27:30 -1000 >Subject: [PATCH] Bug 26053: Add unit test for Koha::Patron::Restriction > >Run: >prove t/db_dependent/Koha/Patron/Restriction.t >--- > t/db_dependent/Koha/Patron/Restriction.t | 61 ++++++++++++++++++++++++ > 1 file changed, 61 insertions(+) > create mode 100755 t/db_dependent/Koha/Patron/Restriction.t > >diff --git a/t/db_dependent/Koha/Patron/Restriction.t b/t/db_dependent/Koha/Patron/Restriction.t >new file mode 100755 >index 0000000000..5dbfd776b6 >--- /dev/null >+++ b/t/db_dependent/Koha/Patron/Restriction.t >@@ -0,0 +1,61 @@ >+#!/usr/bin/perl >+ >+# Copyright 2023 Koha Development team >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses> >+ >+use Modern::Perl; >+ >+use Test::More tests => 3; >+use Test::Exception; >+ >+use Koha::Database; >+use Koha::DateUtils qw( dt_from_string ); >+ >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+ >+my $builder = t::lib::TestBuilder->new; >+ >+use_ok('Koha::Patron::Restriction'); >+use_ok('Koha::Patron::Restrictions'); >+ >+subtest 'is_expired' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $debarment = $builder->build({ source => 'BorrowerDebarment' }); >+ my $restriction = Koha::Patron::Restrictions->find( $debarment->{borrower_debarment_id} ); >+ >+ $restriction->expiration( undef )->store->discard_changes; >+ is( $restriction->is_expired, 0, 'Restriction should not be considered expired if dateexpiry is not set'); >+ >+ $restriction->expiration( dt_from_string )->store->discard_changes; >+ is( $restriction->is_expired, 0, 'Restriction should not be considered expired if dateexpiry is today'); >+ >+ $restriction->expiration( dt_from_string->add( days => 1 ) )->store->discard_changes; >+ is( $restriction->is_expired, 0, 'Restriction should not be considered expired if dateexpiry is tomorrow'); >+ >+ $restriction->expiration( dt_from_string->add( days => -1 ) )->store->discard_changes; >+ is( $restriction->is_expired, 1, 'Restriction should be considered expired if dateexpiry is yesterday'); >+ >+ $schema->storage->txn_rollback; >+}; >+ >+1; >-- >2.42.0
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 26053
:
107488
|
156026
|
156095
|
156109
|
156423
|
156424
|
156425
|
156426
|
156427
|
156428
|
156725
|
156726
|
156727
|
156728
|
156757
|
156758
|
156762
|
156763