[Bast-commits] r6717 - DBIx-Class/0.08/branches/prefetch_limit/t/prefetch

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Fri Jun 19 13:40:38 GMT 2009


Author: ribasushi
Date: 2009-06-19 13:40:38 +0000 (Fri, 19 Jun 2009)
New Revision: 6717

Added:
   DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/with_limit.t
Removed:
   DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/rows_bug.t
Log:
Rename test

Deleted: DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/rows_bug.t
===================================================================
--- DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/rows_bug.t	2009-06-19 13:39:43 UTC (rev 6716)
+++ DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/rows_bug.t	2009-06-19 13:40:38 UTC (rev 6717)
@@ -1,85 +0,0 @@
-# Test to ensure we get a consistent result set wether or not we use the
-# prefetch option in combination rows (LIMIT).
-use strict;
-use warnings;
-
-use Test::More;
-use Test::Exception;
-use lib qw(t/lib);
-use DBICTest;
-
-plan tests => 7;
-
-my $schema = DBICTest->init_schema();
-
-
-my $no_prefetch = $schema->resultset('Artist')->search(
-  undef,
-  { rows => 3 }
-);
-
-my $use_prefetch = $schema->resultset('Artist')->search(
-  [   # search deliberately contrived
-    { 'artwork.cd_id' => undef },
-    { 'tracks.title' => { '!=' => 'blah-blah-1234568' }}
-  ],
-  {
-    prefetch => 'cds',
-    join => { cds => [qw/artwork tracks/] },
-    rows     => 3,
-    order_by => { -desc => 'name' },
-  }
-);
-
-is($no_prefetch->count, $use_prefetch->count, '$no_prefetch->count == $use_prefetch->count');
-is(
-  scalar ($no_prefetch->all),
-  scalar ($use_prefetch->all),
-  "Amount of returned rows is right"
-);
-
-my $artist_many_cds = $schema->resultset('Artist')->search ( {}, {
-  join => 'cds',
-  group_by => 'me.artistid',
-  having => \ 'count(cds.cdid) > 1',
-})->first;
-
-
-$no_prefetch = $schema->resultset('Artist')->search(
-  { artistid => $artist_many_cds->id },
-  { rows => 1 }
-);
-
-$use_prefetch = $no_prefetch->search ({}, { prefetch => 'cds' });
-
-my $normal_artist = $no_prefetch->single;
-my $prefetch_artist = $use_prefetch->find({ name => $artist_many_cds->name });
-my $prefetch2_artist = $use_prefetch->first;
-
-is(
-  $prefetch_artist->cds->count,
-  $normal_artist->cds->count,
-  "Count of child rel with prefetch + rows => 1 is right (find)"
-);
-is(
-  $prefetch2_artist->cds->count,
-  $normal_artist->cds->count,
-  "Count of child rel with prefetch + rows => 1 is right (first)"
-);
-
-is (
-  scalar ($prefetch_artist->cds->all),
-  scalar ($normal_artist->cds->all),
-  "Amount of child rel rows with prefetch + rows => 1 is right (find)"
-);
-is (
-  scalar ($prefetch2_artist->cds->all),
-  scalar ($normal_artist->cds->all),
-  "Amount of child rel rows with prefetch + rows => 1 is right (first)"
-);
-
-throws_ok (
-  sub { $use_prefetch->single },
-  qr/resultsets prefetching has_many/,
-  'single() with multiprefetch is illegal',
-);

Copied: DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/with_limit.t (from rev 6716, DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/rows_bug.t)
===================================================================
--- DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/with_limit.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/prefetch_limit/t/prefetch/with_limit.t	2009-06-19 13:40:38 UTC (rev 6717)
@@ -0,0 +1,85 @@
+# Test to ensure we get a consistent result set wether or not we use the
+# prefetch option in combination rows (LIMIT).
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+use lib qw(t/lib);
+use DBICTest;
+
+plan tests => 7;
+
+my $schema = DBICTest->init_schema();
+
+
+my $no_prefetch = $schema->resultset('Artist')->search(
+  undef,
+  { rows => 3 }
+);
+
+my $use_prefetch = $schema->resultset('Artist')->search(
+  [   # search deliberately contrived
+    { 'artwork.cd_id' => undef },
+    { 'tracks.title' => { '!=' => 'blah-blah-1234568' }}
+  ],
+  {
+    prefetch => 'cds',
+    join => { cds => [qw/artwork tracks/] },
+    rows     => 3,
+    order_by => { -desc => 'name' },
+  }
+);
+
+is($no_prefetch->count, $use_prefetch->count, '$no_prefetch->count == $use_prefetch->count');
+is(
+  scalar ($no_prefetch->all),
+  scalar ($use_prefetch->all),
+  "Amount of returned rows is right"
+);
+
+my $artist_many_cds = $schema->resultset('Artist')->search ( {}, {
+  join => 'cds',
+  group_by => 'me.artistid',
+  having => \ 'count(cds.cdid) > 1',
+})->first;
+
+
+$no_prefetch = $schema->resultset('Artist')->search(
+  { artistid => $artist_many_cds->id },
+  { rows => 1 }
+);
+
+$use_prefetch = $no_prefetch->search ({}, { prefetch => 'cds' });
+
+my $normal_artist = $no_prefetch->single;
+my $prefetch_artist = $use_prefetch->find({ name => $artist_many_cds->name });
+my $prefetch2_artist = $use_prefetch->first;
+
+is(
+  $prefetch_artist->cds->count,
+  $normal_artist->cds->count,
+  "Count of child rel with prefetch + rows => 1 is right (find)"
+);
+is(
+  $prefetch2_artist->cds->count,
+  $normal_artist->cds->count,
+  "Count of child rel with prefetch + rows => 1 is right (first)"
+);
+
+is (
+  scalar ($prefetch_artist->cds->all),
+  scalar ($normal_artist->cds->all),
+  "Amount of child rel rows with prefetch + rows => 1 is right (find)"
+);
+is (
+  scalar ($prefetch2_artist->cds->all),
+  scalar ($normal_artist->cds->all),
+  "Amount of child rel rows with prefetch + rows => 1 is right (first)"
+);
+
+throws_ok (
+  sub { $use_prefetch->single },
+  qr/resultsets prefetching has_many/,
+  'single() with multiprefetch is illegal',
+);




More information about the Bast-commits mailing list