Commit | Line | Data |
25546937 |
1 | use strict; |
f54428ab |
2 | use warnings; |
25546937 |
3 | |
25546937 |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
25546937 |
7 | |
8 | my $ping_count = 0; |
9 | |
10 | { |
11 | local $SIG{__WARN__} = sub {}; |
12 | require DBIx::Class::Storage::DBI; |
13 | |
14 | my $ping = \&DBIx::Class::Storage::DBI::_ping; |
15 | |
16 | *DBIx::Class::Storage::DBI::_ping = sub { |
17 | $ping_count++; |
18 | goto &$ping; |
19 | }; |
20 | } |
21 | |
d68d84f8 |
22 | |
9ae966b9 |
23 | # measure pings around deploy() separately |
d68d84f8 |
24 | my $schema = DBICTest->init_schema( sqlite_use_file => 1, no_populate => 1 ); |
25 | |
9ae966b9 |
26 | is ($ping_count, 0, 'no _ping() calls during deploy'); |
27 | $ping_count = 0; |
28 | |
29 | |
d68d84f8 |
30 | |
31 | DBICTest->populate_schema ($schema); |
32 | |
28be49a6 |
33 | # perform some operations and make sure they don't ping |
25546937 |
34 | |
28be49a6 |
35 | $schema->resultset('CD')->create({ |
36 | cdid => 6, artist => 3, title => 'mtfnpy', year => 2009 |
37 | }); |
25546937 |
38 | |
28be49a6 |
39 | $schema->resultset('CD')->create({ |
40 | cdid => 7, artist => 3, title => 'mtfnpy2', year => 2009 |
41 | }); |
25546937 |
42 | |
28be49a6 |
43 | $schema->storage->_dbh->disconnect; |
25546937 |
44 | |
28be49a6 |
45 | $schema->resultset('CD')->create({ |
46 | cdid => 8, artist => 3, title => 'mtfnpy3', year => 2009 |
47 | }); |
25546937 |
48 | |
28be49a6 |
49 | $schema->storage->_dbh->disconnect; |
25546937 |
50 | |
28be49a6 |
51 | $schema->txn_do(sub { |
52 | $schema->resultset('CD')->create({ |
53 | cdid => 9, artist => 3, title => 'mtfnpy4', year => 2009 |
54 | }); |
55 | }); |
25546937 |
56 | |
57 | is $ping_count, 0, 'no _ping() calls'; |
d68d84f8 |
58 | |
59 | done_testing; |