[Bast-commits] r6259 - DBIx-Class/0.08/branches/joined_count/t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Thu May 14 11:19:59 GMT 2009


Author: ribasushi
Date: 2009-05-14 11:19:59 +0000 (Thu, 14 May 2009)
New Revision: 6259

Modified:
   DBIx-Class/0.08/branches/joined_count/t/60core.t
   DBIx-Class/0.08/branches/joined_count/t/90join_torture.t
Log:
Questionable test changes - need a review

Modified: DBIx-Class/0.08/branches/joined_count/t/60core.t
===================================================================
--- DBIx-Class/0.08/branches/joined_count/t/60core.t	2009-05-14 11:19:35 UTC (rev 6258)
+++ DBIx-Class/0.08/branches/joined_count/t/60core.t	2009-05-14 11:19:59 UTC (rev 6259)
@@ -234,9 +234,14 @@
 
 my( $or_rs ) = $schema->resultset("CD")->search_rs($search, { join => 'tags',
                                                   order_by => 'cdid' });
+# At this point in the test there are:
+# 1 artist with the cheesy AND blue tag
+# 1 artist with the cheesy tag
+# 2 artists with the blue tag
+#
+# Formerly this test expected 5 as there was no collapsing of the AND condition
+is($or_rs->count, 4, 'Search with OR ok');
 
-is($or_rs->count, 5, 'Search with OR ok');
-
 my $distinct_rs = $schema->resultset("CD")->search($search, { join => 'tags', distinct => 1 });
 is($distinct_rs->all, 4, 'DISTINCT search with OR ok');
 
@@ -276,7 +281,13 @@
 
 my $rel_rs = $tag_rs->search_related('cd');
 
-is($rel_rs->count, 5, 'Related search ok');
+# At this point in the test there are:
+# 1 artist with the cheesy AND blue tag
+# 1 artist with the cheesy tag
+# 2 artists with the blue tag
+#
+# Formerly this test expected 5 as there was no collapsing of the AND condition
+is($rel_rs->count, 4, 'Related search ok');
 
 is($or_rs->next->cdid, $rel_rs->next->cdid, 'Related object ok');
 $or_rs->reset;

Modified: DBIx-Class/0.08/branches/joined_count/t/90join_torture.t
===================================================================
--- DBIx-Class/0.08/branches/joined_count/t/90join_torture.t	2009-05-14 11:19:35 UTC (rev 6258)
+++ DBIx-Class/0.08/branches/joined_count/t/90join_torture.t	2009-05-14 11:19:59 UTC (rev 6259)
@@ -45,11 +45,25 @@
 cmp_ok(scalar @cds, '==', 1, "condition based on inherited join okay");
 
 my $rs3 = $rs2->search_related('cds');
+
+# $rs3 selects * from cds_2, with the following join map
+#
+# artist -> cds_2
+#   |
+#   V
+#  cds -> cd_to_producer -> producer
+#   |
+#   |\--> tags
+#   V
+# tracks
+#
+# For some reason it is expected to return an exploded set of rows instead of the
+# logical 3, even for a rowobject retrieval - why?
+#
 cmp_ok(scalar($rs3->all), '==', 45, "All cds for artist returned");
 
+cmp_ok($rs3->count, '==', 3, "All cds for artist returned via count");
 
-cmp_ok($rs3->count, '==', 45, "All cds for artist returned via count");
-
 my $rs4 = $schema->resultset("CD")->search({ 'artist.artistid' => '1' }, { join => ['tracks', 'artist'], prefetch => 'artist' });
 my @rs4_results = $rs4->all;
 




More information about the Bast-commits mailing list