Koha/t/lib
Joonas Kylmälä 188479881f Bug 28479: Use primary keys to check object existence in TestBuilder
The TestBuilder::build_object function used any foreign keys to check
whether an object already exists or not. This brought incorrectly
results of unrelated objects because using any other keys other than
primary keys don't guarantee our results to point to one single
object. For example, as is put here in the unit test, if you created
two items with the same biblionumber and then tried to create a hold
using build_object() we were using the biblionumber to check whether
an item was linked to the hold already. Thus, we were checking whether
a random item was already linked to the hold instead of the one we
wanted either by passing it explicitly to build_object() or the one
build_object() created implicitly. This also resulted in following
warnings when there were more than one match:

DBIx::Class::Storage::DBI::select_single(): Query returned more than
one row.  SQL that returns multiple rows is DEPRECATED for ->find and
->single at /kohadevbox/koha/t/lib/TestBuilder.pm line 235

To test:
 $ prove t/db_dependent

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2021-07-02 08:54:39 -04:00
..
Koha Bug 24000: Some modules do not return 1 2021-04-06 15:56:30 +02:00
QA Bug 27336: Fix xt/find-missing-filters.t 2021-01-11 10:27:37 +01:00
Dates.pm
Mocks.pm Bug 24786: (QA follow-up) Unit tests for Registers plugin 2020-11-06 15:40:00 +01:00
Selenium.pm Bug 28250: Remove upload of debug for Selenium failures 2021-04-30 17:07:31 +02:00
TestBuilder.pm Bug 28479: Use primary keys to check object existence in TestBuilder 2021-07-02 08:54:39 -04:00