Bug 17733: Fix Members.t

In some dirty DB (Jenkins), the borrowers.guarantorid field is not set
to a valid patron id.
That make some tests fail if we create a patron with that patron id.

In my DB, auto increment for borrowers is set to 52 before the tests
On the 4th run of the tests, some tests fail.
Before I got a patron with a guarantorid=112 (I let you do the math).

Test plan:
The easiest is to trust me

Todo: Add a FK!
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Opened a new report for special case: Bug 17759.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-12-06 17:09:21 +01:00 committed by Kyle M Hall
parent 6b67f635b1
commit 62074e39f0
1 changed files with 5 additions and 0 deletions

View File

@ -294,6 +294,11 @@ $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);