https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 137600 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=137600&action=edit Bug 31133: Add a way to handle multiple relationships on same column This patch introduces a syntax for TestBuilder so we can specify which is the preferred relationship in situations like Koha::Checkouts::Renewals that have more than one virtual FK [1] for the same column. In this case, there are the following relationships: * checkouts * old_checkouts both of which link the *checkout_id* column to the *issue_id* column of the **issues** and **old_issues** tables respectively. It does so by defining a mapping between the (concatenated, maybe multiple) related source column and foreign counterpart. The mapping structure is explained in the POD. To test: 1. Apply the regression tests 2. Run the tests a couple times: $ kshell k$ prove t/db_dependent/TestBuilder_multi_vfk.t => FAIL: Tests fail often, randomly! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! No random failures! 5. Bonus, run: $ kshell k$ prove t/db_dependent/TestBuilder.t => FAIL: It fails consistently about Koha::Biblio::ItemGroup [1] i.e. defined at DBIC level but not present on the DB structure. DISCLAIMER: This is not a complete solution as it still requires a way to override the hardcoded default. This would require a special syntax for build() and build_object() which I prefer to delay until we really need it. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.