Bugzilla – Attachment 137634 Details for
Bug 31133
TestBuilder fragile on virtual fks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31133: Don't generate values for more than one FK
Bug-31133-Dont-generate-values-for-more-than-one-F.patch (text/plain), 1.55 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-07-12 14:08:13 UTC
(
hide
)
Description:
Bug 31133: Don't generate values for more than one FK
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-07-12 14:08:13 UTC
Size:
1.55 KB
patch
obsolete
>From fdc933adb49256bb0b61a2189126dc4ad8c37143 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 12 Jul 2022 09:11:12 +0200 >Subject: [PATCH] Bug 31133: Don't generate values for more than one FK > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/lib/TestBuilder.pm | 10 ++++++++++ > 1 file changed, 10 insertions(+) > >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 94ffa97510..28a55fd4c3 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -123,9 +123,16 @@ sub build { > # loop thru all fk and create linked records if needed > # fills remaining entries in $col_values > my $foreign_keys = $self->_getForeignKeys( { source => $source } ); >+ my $col_names = {}; > for my $fk ( @$foreign_keys ) { > # skip when FK points to itself: e.g. borrowers:guarantorid > next if $fk->{source} eq $source; >+ >+ # If we have more than one FK on the same column, we only generate values for the first one >+ next >+ if scalar @{ $fk->{keys} } == 1 >+ && exists $col_names->{ $fk->{keys}->[0]->{col_name} }; >+ > my $keys = $fk->{keys}; > my $tbl = $fk->{source}; > my $res = $self->_create_links( $tbl, $keys, $col_values, $value ); >@@ -133,6 +140,9 @@ sub build { > foreach( keys %$res ) { # save new values > $col_values->{$_} = $res->{$_}; > } >+ >+ $col_names->{ $fk->{keys}->[0]->{col_name} } = 1 >+ if scalar @{ $fk->{keys} } == 1 > } > > # store this record and return hashref >-- >2.34.1
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 31133
:
137599
|
137600
|
137603
|
137604
| 137634