Bugzilla – Attachment 158211 Details for
Bug 32730
Add patron lists tab to patron details and circulation pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32730: Add tests for Koha::Patron->get_lists_with_patron
Bug-32730-Add-tests-for-KohaPatron-getlistswithpat.patch (text/plain), 2.15 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-11-01 19:57:08 UTC
(
hide
)
Description:
Bug 32730: Add tests for Koha::Patron->get_lists_with_patron
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-11-01 19:57:08 UTC
Size:
2.15 KB
patch
obsolete
>From a0ba3ab7accd664fb0fa7adb8e51d5da0bb8dbc5 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 1 Nov 2023 16:52:08 -0300 >Subject: [PATCH] Bug 32730: Add tests for Koha::Patron->get_lists_with_patron > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Patron.t | 33 ++++++++++++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index 12879efe7c7..7313a5d5856 100755 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 30; >+use Test::More tests => 31; > use Test::Exception; > use Test::Warn; > use Time::Fake; >@@ -29,6 +29,7 @@ use Koha::Database; > use Koha::DateUtils qw(dt_from_string); > use Koha::ArticleRequests; > use Koha::Patrons; >+use Koha::List::Patron qw(AddPatronList AddPatronsToList); > use Koha::Patron::Relationships; > use C4::Circulation qw( AddIssue AddReturn ); > >@@ -2114,3 +2115,33 @@ subtest 'update_lastseen tests' => sub { > Time::Fake->reset; > $schema->storage->txn_rollback; > }; >+ >+subtest 'get_lists_with_patron() tests' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $owner = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ my $list_1 = AddPatronList( { name => ' Ya', owner => $owner->id } ); >+ my $list_2 = AddPatronList( { name => 'Hey!', owner => $owner->id } ); >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ my @lists = $patron->get_lists_with_patron(); >+ >+ is( scalar @lists, 0, 'Patron not included in any list' ); >+ >+ AddPatronsToList( { list => $list_1, cardnumbers => [ $patron->cardnumber ] } ); >+ AddPatronsToList( { list => $list_2, cardnumbers => [ $patron->cardnumber ] } ); >+ >+ @lists = $patron->get_lists_with_patron(); >+ foreach my $list (@lists) { >+ is( ref($list), 'Koha::Schema::Result::PatronList', 'Type is correct' ); >+ } >+ >+ is( join( ' ', map { $_->name } @lists ), ' Ya Hey!', 'Lists are the correct ones, and sorted alphabetically' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >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 32730
:
145668
|
145710
|
145744
|
145745
|
145768
|
145977
|
146039
|
147981
|
147982
|
149477
|
154672
|
155575
|
155589
|
157992
|
158209
|
158210
| 158211