X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F31stats.t;h=9f0da400a428c799872fd3d1f23d82b53389d310;hb=dd7ae774c024f460ef47e1c6a5b3a3d945cb9936;hp=a478d2804296cd88d05556c266ceed18ecbc38a5;hpb=4c24816137de09c629fcd3da41b7626d50cc13f6;p=dbsrgits%2FDBIx-Class.git diff --git a/t/31stats.t b/t/31stats.t index a478d28..9f0da40 100644 --- a/t/31stats.t +++ b/t/31stats.t @@ -8,29 +8,29 @@ BEGIN { eval "use DBD::SQLite"; plan $@ ? ( skip_all => 'needs DBD::SQLite for testing' ) - : ( tests => 13 ); + : ( tests => 12 ); } use lib qw(t/lib); use_ok('DBICTest'); -use_ok('DBICTest::HelperRels'); +my $schema = DBICTest->init_schema(); my $cbworks = 0; -DBICTest->schema->storage->debugcb(sub { $cbworks = 1; }); -DBICTest->schema->storage->debug(0); -my $rs = DBICTest::CD->search({}); +$schema->storage->debugcb(sub { $cbworks = 1; }); +$schema->storage->debug(0); +my $rs = $schema->resultset('CD')->search({}); $rs->count(); ok(!$cbworks, 'Callback not called with debug disabled'); -DBICTest->schema->storage->debug(1); +$schema->storage->debug(1); $rs->count(); ok($cbworks, 'Debug callback worked.'); my $prof = new DBIx::Test::Profiler(); -DBICTest->schema->storage->debugobj($prof); +$schema->storage->debugobj($prof); # Test non-transaction calls. $rs->count(); @@ -42,27 +42,27 @@ ok(!$prof->{'txn_commit'}, 'txn_commit not called'); $prof->reset(); # Test transaction calls -DBICTest->schema->txn_begin(); +$schema->txn_begin(); ok($prof->{'txn_begin'}, 'txn_begin called'); -$rs = DBICTest::CD->search({}); +$rs = $schema->resultset('CD')->search({}); $rs->count(); ok($prof->{'query_start'}, 'query_start called'); ok($prof->{'query_end'}, 'query_end called'); -DBICTest->schema->txn_commit(); +$schema->txn_commit(); ok($prof->{'txn_commit'}, 'txn_commit called'); $prof->reset(); # Test a rollback -DBICTest->schema->txn_begin(); -$rs = DBICTest::CD->search({}); +$schema->txn_begin(); +$rs = $schema->resultset('CD')->search({}); $rs->count(); -DBICTest->schema->txn_rollback(); +$schema->txn_rollback(); ok($prof->{'txn_rollback'}, 'txn_rollback called'); -DBICTest->schema->storage->debug(0); +$schema->storage->debug(0); package DBIx::Test::Profiler; use strict;