Run the entire test suite under replicated SQLite on DBICTEST_VIA_REPLICATED
[dbsrgits/DBIx-Class.git] / t / storage / disable_sth_caching.t
1 use strict;
2 use warnings;
3
4 BEGIN { $ENV{DBICTEST_VIA_REPLICATED} = 0 }
5
6 use Test::More;
7 use lib qw(t/lib);
8 use DBICTest;
9
10 ##!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11 ## This test uses undocumented internal methods
12 ## DO NOT USE THEM IN THE SAME MANNER
13 ## They are subject to ongoing change
14 ##!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
15
16 # Set up the "usual" sqlite for DBICTest
17 my $schema = DBICTest->init_schema;
18 my $dbh = $schema->storage->_get_dbh;
19
20 my $sth_one = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
21 my $sth_two = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
22 $schema->storage->disable_sth_caching(1);
23 my $sth_three = $schema->storage->_prepare_sth($dbh, 'SELECT 42');
24
25 ok($sth_one == $sth_two, "statement caching works");
26 ok($sth_two != $sth_three, "disabling statement caching works");
27
28 done_testing;