[Bast-commits] r6815 -
DBIx-Class/0.08/branches/search_related_prefetch/t/prefetch
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sun Jun 28 08:34:17 GMT 2009
Author: ribasushi
Date: 2009-06-28 08:34:16 +0000 (Sun, 28 Jun 2009)
New Revision: 6815
Added:
DBIx-Class/0.08/branches/search_related_prefetch/t/prefetch/count.t
Log:
Thetest case that started it all
Added: DBIx-Class/0.08/branches/search_related_prefetch/t/prefetch/count.t
===================================================================
--- DBIx-Class/0.08/branches/search_related_prefetch/t/prefetch/count.t (rev 0)
+++ DBIx-Class/0.08/branches/search_related_prefetch/t/prefetch/count.t 2009-06-28 08:34:16 UTC (rev 6815)
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+plan tests => 5;
+
+my $schema = DBICTest->init_schema();
+
+my $cd_rs = $schema->resultset('CD')->search (
+ { 'tracks.cd' => { '!=', undef } },
+ { prefetch => ['tracks', 'artist'] },
+);
+
+
+is($cd_rs->count, 5, 'CDs with tracks count');
+is($cd_rs->search_related('tracks')->count, 15, 'Tracks associated with CDs count (before SELECT()ing)');
+
+is($cd_rs->all, 5, 'Amount of CD objects with tracks');
+is($cd_rs->search_related('tracks')->count, 15, 'Tracks associated with CDs count (after SELECT()ing)');
+
+is($cd_rs->search_related ('tracks')->all, 15, 'Track objects associated with CDs (after SELECT()ing)');
More information about the Bast-commits
mailing list