Bugzilla – Attachment 115860 Details for
Bug 27554
Clarify and add tests for Koha::Patrons->update_category_to child to adult
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27554: Add a test for Koha::Patrons->update_category_to child to adult
Bug-27554-Add-a-test-for-KohaPatrons-updatecategor.patch (text/plain), 2.82 KB, created by
David Nind
on 2021-01-27 09:55:56 UTC
(
hide
)
Description:
Bug 27554: Add a test for Koha::Patrons->update_category_to child to adult
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-01-27 09:55:56 UTC
Size:
2.82 KB
patch
obsolete
>From 75e5f8b6fd9f20ce6cf682b0c4777848cbf4c5a5 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Tue, 26 Jan 2021 16:17:06 +0100 >Subject: [PATCH] Bug 27554: Add a test for Koha::Patrons->update_category_to > child to adult > >One unit test for Koha::Patrons->update_category_to seems wrong : > is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category'); > >Child is updated to adult because he his too old, not too young. > >This patch adds a test on category of patron that should be an >adult after update. > >Test plan : >1) Without patch, run t/db_dependent/Patrons.t >2) It does not fail >3) Apply patch, run t/db_dependent/Patrons.t >4) It fails on test 'The over age patron has been updated to adult category' > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/Patrons.t | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t >index 2aa964a28b..e890472a37 100755 >--- a/t/db_dependent/Patrons.t >+++ b/t/db_dependent/Patrons.t >@@ -106,7 +106,7 @@ foreach my $b ( $patrons->as_list() ) { > } > > subtest "Update patron categories" => sub { >- plan tests => 20; >+ plan tests => 21; > t::lib::Mocks::mock_preference( 'borrowerRelationship', 'test' ); > my $c_categorycode = $builder->build({ source => 'Category', value => { > category_type=>'C', >@@ -191,9 +191,12 @@ subtest "Update patron categories" => sub { > is( Koha::Patrons->search_patrons_to_update_category({from=>$a_categorycode,fine_max=>5})->count,2,'Two patrons with fines under $5, patron with no fine history is found'); > > is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,3,'Guarantor has 3 guarantees'); >+ > is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode})->update_category_to({category=>$c_categorycode_2}),3,'Three child patrons updated to another child category with no params passed'); > is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,3,'Guarantees not removed when made changing child categories'); >+ > is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category'); >+ is( Koha::Patrons->find($child3->borrowernumber)->categorycode,$a_categorycode,'The over age patron has been updated to adult category'); > is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,2,'Guarantee was removed when made adult'); > > is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,1,'Guarantor has 1 guarantees'); >-- >2.11.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 27554
:
115849
|
115850
|
115860
|
115861
|
115933
|
115934
|
116097
|
116171