X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fprefetch%2Fmanual.t;h=83870ae9369c6971ae79fe602a479591c30de6b3;hb=2603b49536d45448ac98cd8aa7c7393867cb0db2;hp=22281429fcf0095bef7ebf88d815b321bd4e09cb;hpb=fb88ca2c952ef2e17f6e8a414079f12f71761ff7;p=dbsrgits%2FDBIx-Class.git diff --git a/t/prefetch/manual.t b/t/prefetch/manual.t index 2228142..83870ae 100644 --- a/t/prefetch/manual.t +++ b/t/prefetch/manual.t @@ -1,3 +1,5 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; @@ -5,7 +7,7 @@ use Test::More; use Test::Deep; use Test::Warn; use Test::Exception; -use lib qw(t/lib); + use DBICTest; delete $ENV{DBIC_COLUMNS_INCLUDE_FILTER_RELS}; @@ -257,24 +259,20 @@ if ($ENV{TEST_VERBOSE}) { for @lines; } -{ - my $queries = 0; - $schema->storage->debugcb(sub { $queries++ }); - my $orig_debug = $schema->storage->debug; - $schema->storage->debug (1); - +$schema->is_executed_querycount( sub { for my $use_next (0, 1) { my @random_cds; + my $rs_r = $rs_random; if ($use_next) { warnings_exist { - while (my $o = $rs_random->next) { + while (my $o = $rs_r->next) { push @random_cds, $o; } } qr/performed an eager cursor slurp underneath/, 'Warned on auto-eager cursor'; } else { - @random_cds = $rs_random->all; + @random_cds = $rs_r->all; } is (@random_cds, 6, 'object count matches'); @@ -306,11 +304,7 @@ if ($ENV{TEST_VERBOSE}) { } } } - - $schema->storage->debugcb(undef); - $schema->storage->debug($orig_debug); - is ($queries, 2, "Only two queries for two prefetch calls total"); -} +}, 2, "Only two queries for two prefetch calls total"); # can't cmp_deeply a random set - need *some* order my $ord_rs = $rs->search({}, {