Bugzilla – Attachment 51057 Details for
Bug 16407
Fix Koha_borrower_modifications.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16407: Fix Koha_borrower_modifications.t
Bug-16407-Fix-Kohaborrowermodificationst.patch (text/plain), 3.90 KB, created by
Marcel de Rooy
on 2016-04-30 15:00:52 UTC
(
hide
)
Description:
Bug 16407: Fix Koha_borrower_modifications.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-04-30 15:00:52 UTC
Size:
3.90 KB
patch
obsolete
>From 7f34e309d18d506250d2e8aaede528dda3eda975 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Sat, 30 Apr 2016 16:55:28 +0200 >Subject: [PATCH] Bug 16407: Fix Koha_borrower_modifications.t >Content-Type: text/plain; charset=utf-8 > >This test was using hardcoded borrower number, assuming they should be >present. Now we use TestBuilder. > >Test plan: >Run the test. >--- > t/db_dependent/Koha_borrower_modifications.t | 23 ++++++++++++++--------- > 1 file changed, 14 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Koha_borrower_modifications.t b/t/db_dependent/Koha_borrower_modifications.t >index 73220f8..7763e5e 100755 >--- a/t/db_dependent/Koha_borrower_modifications.t >+++ b/t/db_dependent/Koha_borrower_modifications.t >@@ -4,6 +4,7 @@ use Modern::Perl; > use Test::More tests => 14; > > use C4::Context; >+use t::lib::TestBuilder; > use C4::Members; > > use Koha::Patron::Modifications; >@@ -48,7 +49,10 @@ ok( > ); > > ## Create new pending modification, but for an existing borrower >-Koha::Patron::Modifications->new( borrowernumber => '2' ) >+## But not a hardcoded borrowernumber of course (Bug 16407) >+my $builder = t::lib::TestBuilder->new; >+my $borr1 = $builder->build({ source => 'Borrower' })->{borrowernumber}; >+Koha::Patron::Modifications->new( borrowernumber => $borr1 ) > ->AddModifications( { surname => 'Hall', firstname => 'Kyle' } ); > > ## Test the counter >@@ -56,7 +60,8 @@ ok( Koha::Patron::Modifications->GetPendingModificationsCount() == 1, > 'Test GetPendingModificationsCount()' ); > > ## Create new pending modification for another existing borrower >-Koha::Patron::Modifications->new( borrowernumber => '3' ) >+my $borr2 = $builder->build({ source => 'Borrower' })->{borrowernumber}; >+Koha::Patron::Modifications->new( borrowernumber => $borr2 ) > ->AddModifications( { surname => 'Smith', firstname => 'Sandy' } ); > > ## Test the counter >@@ -72,17 +77,17 @@ ok( $firstnames_mod[0] eq 'Kyle', 'Test GetPendingModifications()' ); > ok( $firstnames_mod[1] eq 'Sandy', 'Test GetPendingModifications() again' ); > > ## This should delete the row from the table >-Koha::Patron::Modifications->DenyModifications('3'); >+Koha::Patron::Modifications->DenyModifications( $borr2 ); > > ## Test the counter > ok( Koha::Patron::Modifications->GetPendingModificationsCount() == 1, > 'Test DenyModifications()' ); > > ## Save a copy of the borrowers original data >-my $old_borrower = GetMember( borrowernumber => '2' ); >+my $old_borrower = GetMember( borrowernumber => $borr1 ); > > ## Apply the modifications >-Koha::Patron::Modifications->ApproveModifications('2'); >+Koha::Patron::Modifications->ApproveModifications( $borr1 ); > > ## Test the counter > ok( >@@ -91,14 +96,14 @@ ok( > ); > > ## Get a copy of the borrowers current data >-my $new_borrower = GetMember( borrowernumber => '2' ); >+my $new_borrower = GetMember( borrowernumber => $borr1 ); > > ## Check to see that the approved modifications were saved > ok( $new_borrower->{'surname'} eq 'Hall', > 'Test ApproveModifications() applys modification to borrower' ); > > ## Now let's put it back the way it was >-Koha::Patron::Modifications->new( borrowernumber => '2' )->AddModifications( >+Koha::Patron::Modifications->new( borrowernumber => $borr1 )->AddModifications( > { > surname => $old_borrower->{'surname'}, > firstname => $old_borrower->{'firstname'} >@@ -110,7 +115,7 @@ ok( Koha::Patron::Modifications->GetPendingModificationsCount() == 1, > 'Test GetPendingModificationsCount()' ); > > ## Apply the modifications >-Koha::Patron::Modifications->ApproveModifications('2'); >+Koha::Patron::Modifications->ApproveModifications( $borr1 ); > > ## Test the counter > ok( >@@ -118,7 +123,7 @@ ok( > 'Test ApproveModifications() removes pending modification from db, again' > ); > >-$new_borrower = GetMember( borrowernumber => '2' ); >+$new_borrower = GetMember( borrowernumber => $borr1 ); > > ## Test to verify the borrower has been updated with the original values > ok( >-- >1.7.10.4
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 16407
:
51057
|
51060
|
51077
|
51078