Merge 'trunk' into 'joined_count'
[dbsrgits/DBIx-Class.git] / t / 60core.t
index 187164d..a568c6e 100644 (file)
@@ -221,8 +221,13 @@ my $search = [ { 'tags.tag' => 'Cheesy' }, { 'tags.tag' => 'Blue' } ];
 
 my( $or_rs ) = $schema->resultset("CD")->search_rs($search, { join => 'tags',
                                                   order_by => 'cdid' });
-
-is($or_rs->count, 5, 'Search with OR 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($or_rs->count, 4, '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');
@@ -260,7 +265,13 @@ my $tag_rs = $schema->resultset('Tag')->search(
 
 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;