rewrite of _collapse_result to support prefetch of multiple has_many
[dbsrgits/DBIx-Class.git] / t / 76select.t
index bee69e6..164f58e 100644 (file)
@@ -9,7 +9,7 @@ use DBIC::SqlMakerTest;
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 24;
+plan tests => 23;
 
 my $rs = $schema->resultset('CD')->search({},
     {
@@ -64,6 +64,7 @@ my $cds = $schema->resultset ('CD')->search ({}, { order_by => 'me.cdid'}); # ma
 cmp_ok ($cds->count, '>', 2, 'Initially populated with more than 2 CDs');
 
 my $table = $cds->result_source->name;
+$table = $$table if ref $table eq 'SCALAR';
 my $subsel = $cds->search ({}, {
     columns => [qw/cdid title/],
     from => \ "(SELECT cdid, title FROM $table LIMIT 2) me",
@@ -164,34 +165,19 @@ my $sub_rs = $rs->search ({},
   }
 );
 
-is_deeply (
-  $sub_rs->single,
-  {
-    artist => 1,
-    track_position => 2,
-    tracks =>
-      {
-        trackid => 17,
-        title => 'Apiary',
-      },
-  },
-  'columns/select/as fold properly on sub-searches',
-);
-
-TODO: {
-  local $TODO = "Multi-collapsing still doesn't work right - HRI should be getting an arrayref, not an individual hash";
-  is_deeply (
+is_deeply(
     $sub_rs->single,
     {
-      artist => 1,
-      track_position => 2,
-      tracks => [
-        {
-          trackid => 17,
-          title => 'Apiary',
-        },
-      ],
+        artist         => 1,
+        track_position => 2,
+        tracks         => [
+            {
+                trackid => 17,
+                title   => 'Apiary',
+            },
+        ],
     },
     'columns/select/as fold properly on sub-searches',
-  );
-}
+);
+
+