Lines 10-17
use Test::MockModule;
Link Here
|
10 |
use Koha::Database; |
10 |
use Koha::Database; |
11 |
use Koha::Libraries; |
11 |
use Koha::Libraries; |
12 |
|
12 |
|
13 |
my $verbose = 0; |
|
|
14 |
|
15 |
subtest "Scenario: Show how caching prevents Test::DBIx::Class from working properly and how to circumvent it", sub { |
13 |
subtest "Scenario: Show how caching prevents Test::DBIx::Class from working properly and how to circumvent it", sub { |
16 |
my ($firstSchema, $cachedSchema, $cachedSchema2, $firstLibCount, $libCount); |
14 |
my ($firstSchema, $cachedSchema, $cachedSchema2, $firstLibCount, $libCount); |
17 |
|
15 |
|
Lines 22-36
subtest "Scenario: Show how caching prevents Test::DBIx::Class from working prop
Link Here
|
22 |
|
20 |
|
23 |
$firstLibCount = Koha::Libraries->search->count; # first count normal conn |
21 |
$firstLibCount = Koha::Libraries->search->count; # first count normal conn |
24 |
|
22 |
|
25 |
print "\$firstLibCount '$firstLibCount'\n" if $verbose; |
|
|
26 |
|
27 |
ok($cachedSchema = Koha::Database::get_schema_cached(), |
23 |
ok($cachedSchema = Koha::Database::get_schema_cached(), |
28 |
' And the DB connection is cached'); |
24 |
' And the DB connection is cached'); |
29 |
|
25 |
|
30 |
unlike(getConnectionDBName($cachedSchema), qr/sqlite/i, |
26 |
unlike(getConnectionDBName($cachedSchema), qr/sqlite/i, |
31 |
' And the cached DB connection type is not sqlite'); |
27 |
' And the cached DB connection type is not sqlite'); |
32 |
print "getConnectionDBName() -> ".getConnectionDBName($cachedSchema)."\n" if $verbose; |
|
|
33 |
|
34 |
|
28 |
|
35 |
use_ok('Test::DBIx::Class'); |
29 |
use_ok('Test::DBIx::Class'); |
36 |
my $db = Test::MockModule->new('Koha::Database'); |
30 |
my $db = Test::MockModule->new('Koha::Database'); |
37 |
- |
|
|