From: Ian Wells Date: Thu, 2 Jul 2009 10:43:47 +0000 (+0000) Subject: Confirm prefetch doesn't affect main row fetch, and main row fetch works with and... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a7daf36a4a1cdd5e53d22a3f7a2a743858a9319f;p=dbsrgits%2FDBIx-Class-Historic.git Confirm prefetch doesn't affect main row fetch, and main row fetch works with and without counting --- diff --git a/t/prefetch/count.t b/t/prefetch/count.t index d554abd..df24d5c 100644 --- a/t/prefetch/count.t +++ b/t/prefetch/count.t @@ -5,7 +5,7 @@ use Test::More; use lib qw(t/lib); use DBICTest; -plan tests => 7; +plan tests => 9; my $schema = DBICTest->init_schema(); @@ -25,7 +25,8 @@ is($cd_rs->search_related ('tracks')->all, 15, 'Track objects associated with CD my $artist=$schema->resultset('Artist')->create({name => 'xxx'}); my $artist_rs = $schema->resultset('Artist')->search({artistid => $artist->id}, {prefetch=>'cds'}); -is($artist_rs->related_resultset('cds')->count, 0, "No CDs on a brand new artist"); -is($artist_rs->count, 1, - "No CDs prefetched but the artist is still returned"); +is($artist_rs->count, 1, "New artist found with prefetch turned on"); +is(scalar($artist_rs->all), 1, "New artist fetched with prefetch turned on"); +is($artist_rs->related_resultset('cds')->count, 0, "No CDs counted on a brand new artist"); +is(scalar($artist_rs->related_resultset('cds')->all), 0, "No CDs fetched on a brand new artist (count == fetch)");