Bugzilla – Attachment 115934 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: Clarify and add tests
Bug-27554-Clarify-and-add-tests.patch (text/plain), 3.50 KB, created by
Fridolin Somers
on 2021-01-28 14:25:38 UTC
(
hide
)
Description:
Bug 27554: Clarify and add tests
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2021-01-28 14:25:38 UTC
Size:
3.50 KB
patch
obsolete
>From e473fead4ae38ac49e0ed8b6e6e6276833e7693b Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 28 Jan 2021 13:58:14 +0000 >Subject: [PATCH] Bug 27554: Clarify and add tests > >This patch adds a comment to the existing tests, clarifying what they test, and verifying the expected patron is affected. The >original test should be broken by 26307 when the behvaiour is prevented > >I additionally add a test for 'too old' > >To test: >1 - Apply patch >2 - Prove tests, they should pass >3 - Verify the comments make sense > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> >--- > t/db_dependent/Patrons.t | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t >index 2aa964a28b..a7c2009c3a 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 => 24; > t::lib::Mocks::mock_preference( 'borrowerRelationship', 'test' ); > my $c_categorycode = $builder->build({ source => 'Category', value => { > category_type=>'C', >@@ -192,10 +192,17 @@ subtest "Update patron categories" => sub { > > 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'); >+ >+ # FIXME - The script currently allows you to move patrons to a category that is invalid, this test confirms the current behvaiour > 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->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->next->borrowernumber, $child1->borrowernumber ); >+ 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 because too young'); > is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,2,'Guarantee was removed when made adult'); > >+ is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_old=>1})->next->borrowernumber, $child3->borrowernumber ); >+ is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_old=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category because too old'); >+ is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,1,'Guarantee was removed when made adult'); >+ > is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,1,'Guarantor has 1 guarantees'); > is( Koha::Patrons->search_patrons_to_update_category({from=>$p_categorycode})->update_category_to({category=>$a_categorycode}),1,'One professional patron updated to adult category'); > is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,0,'Guarantee was removed when made adult'); >-- >2.30.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