Bugzilla – Attachment 58119 Details for
Bug 17759
Fixing theoretical problems with guarantorid in Members.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17759: Remove invalid guarantorid's in Members.t
Bug-17759-Remove-invalid-guarantorids-in-Memberst.patch (text/plain), 3.15 KB, created by
Jonathan Druart
on 2016-12-12 13:39:45 UTC
(
hide
)
Description:
Bug 17759: Remove invalid guarantorid's in Members.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-12-12 13:39:45 UTC
Size:
3.15 KB
patch
obsolete
>From 99c7168d998c808bfa1b0eb8f092afe4d440b6c7 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 12 Dec 2016 13:48:40 +0100 >Subject: [PATCH] Bug 17759: Remove invalid guarantorid's in Members.t > >See also bug 17733. As long as we have no FK, these invalid guarantorid's >can make tests fail. >Adding a sql statement to clear them in the beginning of the test. > >Test plan: >[1] Since it seems that AUTO_INC+8, +9 and +10 may fail one or two tests, > we should manipulate one or two borrowers: > Run this SQL query first: >SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '[your database]' and table_name='borrowers'; > Now run: UPDATE borrowers SET guarantorid=[former value + 8] WHERE borrowernumber=[some existing borrowernumber] >[2] Without this patch, run Members.t. Should fail two tests. >[3] Apply the patch. Fetch the new AUTO_INCREMENT value and update > guarantorid accordingly again for the manipulated borrower. >[4] Run the test. It should not fail. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > t/db_dependent/Members.t | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index df309f3..dff6431 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -39,6 +39,9 @@ my $builder = t::lib::TestBuilder->new; > my $dbh = C4::Context->dbh; > $dbh->{RaiseError} = 1; > >+# Remove invalid guarantorid's as long as we have no FK >+$dbh->do("UPDATE borrowers b1 LEFT JOIN borrowers b2 ON b2.borrowernumber=b1.guarantorid SET b1.guarantorid=NULL where b1.guarantorid IS NOT NULL AND b2.borrowernumber IS NULL"); >+ > my $library1 = $builder->build({ > source => 'Branch', > }); >@@ -263,6 +266,7 @@ my $borrower1 = $builder->build({ > categorycode=>'STAFFER', > branchcode => $library3->{branchcode}, > dateexpiry => '2015-01-01', >+ guarantorid=> undef, > }, > }); > my $bor1inlist = $borrower1->{borrowernumber}; >@@ -272,6 +276,7 @@ my $borrower2 = $builder->build({ > categorycode=>'STAFFER', > branchcode => $library3->{branchcode}, > dateexpiry => '2015-01-01', >+ guarantorid=> undef, > }, > }); > >@@ -281,6 +286,7 @@ my $guarantee = $builder->build({ > categorycode=>'KIDclamp', > branchcode => $library3->{branchcode}, > dateexpiry => '2015-01-01', >+ guarantorid=> undef, # will be filled later > }, > }); > >@@ -294,11 +300,6 @@ $builder->build({ > }, > }); > >-# In some dirty DB, the guarantorid is set to a non existent patron id >-# If we pick it, then the tests will fail >-# This should not be needed, we should have a FK on the guarantorid instead >-Koha::Patrons->search({ guarantorid => { -in => [ $borrower1->{borrowernumber}, $borrower2->{borrowernumber} ] }})->update({ guarantorid => undef }); >- > my $owner = AddMember (categorycode => 'STAFFER', branchcode => $library2->{branchcode} ); > my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } ); > my @listpatrons = ($bor1inlist, $bor2inlist); >-- >2.1.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 17759
:
58117
| 58119