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