Bugzilla – Attachment 64007 Details for
Bug 18286
Test::DBIx::Class connection/schema is shadowed by a cached connection/schema
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18286: [Follow-up] Remove assumption on branch count
Bug-18286-Follow-up-Remove-assumption-on-branch-co.patch (text/plain), 1.95 KB, created by
Jonathan Druart
on 2017-06-05 20:53:51 UTC
(
hide
)
Description:
Bug 18286: [Follow-up] Remove assumption on branch count
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-06-05 20:53:51 UTC
Size:
1.95 KB
patch
obsolete
>From 3c6f3b7cb983aa5f3454bc4a1e05693ef74aed81 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 2 May 2017 16:18:41 +0200 >Subject: [PATCH] Bug 18286: [Follow-up] Remove assumption on branch count > >A test in db_dependent should not make assumptions on the number of >branches in the database. If you need one, create one. Removing the >assumption of a non-zero count. > >Removing the library count statement outside the subtest. >Replacing C4::Context by Koha::Database. > >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 | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/01-test_dbic.t b/t/db_dependent/01-test_dbic.t >index 0741332b51..c3d972797c 100644 >--- a/t/db_dependent/01-test_dbic.t >+++ b/t/db_dependent/01-test_dbic.t >@@ -7,14 +7,11 @@ use Modern::Perl; > use Test::More; > use Test::MockModule; > >+use Koha::Database; > use Koha::Libraries; >-use C4::Context; >- >-Koha::Libraries->search->count; > > my $verbose = 0; > >- > subtest "Scenario: Show how caching prevents Test::DBIx::Class from working properly and how to circumvent it", sub { > my ($firstSchema, $cachedSchema, $cachedSchema2, $firstLibCount, $libCount); > >@@ -23,11 +20,8 @@ subtest "Scenario: Show how caching prevents Test::DBIx::Class from working prop > ok($firstSchema = Koha::Database->schema, > 'Step: Given a normal DB connection.'); > >- ok($firstLibCount = Koha::Libraries->search->count, >- ' When the libraries are counted'); >+ $firstLibCount = Koha::Libraries->search->count; # first count normal conn > >- ok($firstLibCount, >- ' Then we got a count'); #There should be something like 12 branches in the default DB but making an accurate check here to prevent surface for brittleness. > print "\$firstLibCount '$firstLibCount'\n" if $verbose; > > ok($cachedSchema = Koha::Database::get_schema_cached(), >-- >2.11.0
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 18286
:
61186
|
62963
|
62964
|
62965
|
62966
|
64004
|
64005
|
64006
| 64007