Modify the null-branch pruning introduced in ce556881, restore compat
[dbsrgits/DBIx-Class.git] / t / prefetch / multiple_hasmany_torture.t
index 973df8b..e0b73b5 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use warnings;
 
 use Test::More;
+use Test::Deep;
 use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
@@ -22,10 +23,11 @@ my $mo_rs = $schema->resultset('Artist')->search(
         ],
 
         result_class => 'DBIx::Class::ResultClass::HashRefInflator',
+
+        order_by => [qw/tracks.position tracks.trackid producer.producerid/],
     }
 );
 
-
 $schema->resultset('Artist')->create(
     {
         name => 'mo',
@@ -90,7 +92,7 @@ my $mo = $mo_rs->next;
 
 is( @{$mo->{cds}}, 2, 'two CDs' );
 
-is_deeply(
+cmp_deeply(
     $mo,
     {
         'cds' => [
@@ -98,7 +100,6 @@ is_deeply(
                 'single_track' => undef,
                 'tracks'       => [
                     {
-                        'small_dt'  => undef,
                         'cd'        => '6',
                         'position'  => '1',
                         'trackid'   => '19',
@@ -108,7 +109,6 @@ is_deeply(
                         'last_updated_at' => undef
                     },
                     {
-                        'small_dt'        => undef,
                         'cd'              => '6',
                         'position'        => '2',
                         'trackid'         => '20',
@@ -118,7 +118,6 @@ is_deeply(
                         'last_updated_at' => undef
                     },
                     {
-                        'small_dt'        => undef,
                         'cd'              => '6',
                         'position'        => '3',
                         'trackid'         => '21',
@@ -128,7 +127,6 @@ is_deeply(
                         'last_updated_at' => undef
                     },
                     {
-                        'small_dt'        => undef,
                         'cd'              => '6',
                         'position'        => '4',
                         'trackid'         => '22',
@@ -144,7 +142,6 @@ is_deeply(
                             'year'         => '2021',
                             'tracks'       => [
                                 {
-                                    'small_dt' => undef,
                                     'cd' => '7',
                                     'position' => '1',
                                     'title' => 'singled out',
@@ -153,7 +150,6 @@ is_deeply(
                                     'last_updated_on' => undef
                                 },
                                 {
-                                    'small_dt' => undef,
                                     'cd' => '7',
                                     'position' => '2',
                                     'title' => 'still alone',
@@ -192,23 +188,7 @@ is_deeply(
             {
                 'single_track' => undef,
                 'tracks'       => [
-                    # FIXME
-                    # although the positional ordering is correct, SQLite seems to return
-                    # the rows randomly if an ORDER BY is not supplied. Of course ordering
-                    # by right side of prefetch joins is not yet possible, thus we just hope
-                    # that the order is stable
-                    {
-                        'small_dt'        => undef,
-                        'cd'              => '8',
-                        'position'        => '2',
-                        'trackid'         => '26',
-                        'title'           => 'Bar Foo',
-                        'cd_single'       => undef,
-                        'last_updated_on' => undef,
-                        'last_updated_at' => undef
-                    },
                     {
-                        'small_dt'  => undef,
                         'cd'        => '8',
                         'position'  => '1',
                         'trackid'   => '25',
@@ -218,7 +198,15 @@ is_deeply(
                         'cd_single'       => undef,
                     },
                     {
-                        'small_dt'        => undef,
+                        'cd'              => '8',
+                        'position'        => '2',
+                        'trackid'         => '26',
+                        'title'           => 'Bar Foo',
+                        'cd_single'       => undef,
+                        'last_updated_on' => undef,
+                        'last_updated_at' => undef
+                    },
+                    {
                         'cd'              => '8',
                         'position'        => '3',
                         'trackid'         => '27',
@@ -234,7 +222,6 @@ is_deeply(
                             'year'         => '2020',
                             'tracks'       => [
                                 {
-                                    'small_dt' => undef,
                                     'cd' => '9',
                                     'position' => '1',
                                     'title' => 'singled out',
@@ -243,7 +230,6 @@ is_deeply(
                                     'last_updated_on' => undef
                                 },
                                 {
-                                    'small_dt' => undef,
                                     'cd' => '9',
                                     'position' => '2',
                                     'title' => 'still alone',