X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F84serialize.t;h=ffa63fa0f50da17d4b1175da2770dde32edf7770;hb=49eeb48de3d8ff685926b595fa0f3f5e680eaee2;hp=ffe03687f519dfb534ad7d2e0c11ce811b7ec735;hpb=2cfc22ddff9cb35524031dfc9d429d294b5e3d6e;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/84serialize.t b/t/84serialize.t index ffe0368..ffa63fa 100644 --- a/t/84serialize.t +++ b/t/84serialize.t @@ -138,17 +138,12 @@ for my $name (keys %stores) { # Test resultsource with cached rows - my $query_count; - $cd_rs = $cd_rs->search ({}, { cache => 1 }); + $schema->is_executed_querycount( sub { + $cd_rs = $cd_rs->search ({}, { cache => 1 }); - my $orig_debug = $schema->storage->debug; - $schema->storage->debug(1); - $schema->storage->debugcb(sub { $query_count++ } ); + # this will hit the database once and prime the cache + my @cds = $cd_rs->all; - # this will hit the database once and prime the cache - my @cds = $cd_rs->all; - - lives_ok { $copy = $store->($cd_rs); ref_ne($copy, $cd_rs, 'Cached resultset cloned'); is_deeply ( @@ -158,12 +153,7 @@ for my $name (keys %stores) { ); is ($copy->count, $cd_rs->count, 'Cached count identical'); - } "serialize cached resultset lives: $name"; - - is ($query_count, 1, 'Only one db query fired'); - - $schema->storage->debug($orig_debug); - $schema->storage->debugcb(undef); + }, 1, 'Only one db query fired'); } # test schema-less detached thaw