|
Lines 7-20
use Modern::Perl;
Link Here
|
| 7 |
use Test::More; |
7 |
use Test::More; |
| 8 |
use Test::MockModule; |
8 |
use Test::MockModule; |
| 9 |
|
9 |
|
|
|
10 |
use Koha::Database; |
| 10 |
use Koha::Libraries; |
11 |
use Koha::Libraries; |
| 11 |
use C4::Context; |
|
|
| 12 |
|
| 13 |
Koha::Libraries->search->count; |
| 14 |
|
12 |
|
| 15 |
my $verbose = 0; |
13 |
my $verbose = 0; |
| 16 |
|
14 |
|
| 17 |
|
|
|
| 18 |
subtest "Scenario: Show how caching prevents Test::DBIx::Class from working properly and how to circumvent it", sub { |
15 |
subtest "Scenario: Show how caching prevents Test::DBIx::Class from working properly and how to circumvent it", sub { |
| 19 |
my ($firstSchema, $cachedSchema, $cachedSchema2, $firstLibCount, $libCount); |
16 |
my ($firstSchema, $cachedSchema, $cachedSchema2, $firstLibCount, $libCount); |
| 20 |
|
17 |
|
|
Lines 23-33
subtest "Scenario: Show how caching prevents Test::DBIx::Class from working prop
Link Here
|
| 23 |
ok($firstSchema = Koha::Database->schema, |
20 |
ok($firstSchema = Koha::Database->schema, |
| 24 |
'Step: Given a normal DB connection.'); |
21 |
'Step: Given a normal DB connection.'); |
| 25 |
|
22 |
|
| 26 |
ok($firstLibCount = Koha::Libraries->search->count, |
23 |
$firstLibCount = Koha::Libraries->search->count; # first count normal conn |
| 27 |
' When the libraries are counted'); |
|
|
| 28 |
|
24 |
|
| 29 |
ok($firstLibCount, |
|
|
| 30 |
' 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. |
| 31 |
print "\$firstLibCount '$firstLibCount'\n" if $verbose; |
25 |
print "\$firstLibCount '$firstLibCount'\n" if $verbose; |
| 32 |
|
26 |
|
| 33 |
ok($cachedSchema = Koha::Database::get_schema_cached(), |
27 |
ok($cachedSchema = Koha::Database::get_schema_cached(), |
| 34 |
- |
|
|