]> git.koha-community.org Git - koha.git/commit
Bug 18286: Test::DBIx::Class connection/schema is shadowed by a cached connection...
authorOlli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Thu, 16 Mar 2017 19:08:31 +0000 (21:08 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 5 Jun 2017 20:52:32 +0000 (17:52 -0300)
commitb5b1d3282e52427b16f1133742908ed27b28ea80
treef796bfc2ebf3f16d5d35f77b5cfdda404b4e6765
parent149d8a6ec2413fc59a8bb51d520adec49b46bbe5
Bug 18286: Test::DBIx::Class connection/schema is shadowed by a cached connection/schema

If Koha::Database->schema gets called before

    use Test::DBIx::Class

The DB connection from $KOHA_CONF is cached.

This happens most of the time because when C4::Context and friends are loaded
(in compile-time?), they already access the DB.

After Test::DBIx::Class is instantiated and hooks put in place to overload
Koha::Schema connection, those hooks are never called due to getting the old
connection from cache.

This feature introduces a test case to replicate the behaviour and shows how
flushing the connection cache solves the problem.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/01-test_dbic.t [new file with mode: 0644]