Fix tests failing due to unspecified resultset retrieval order
[dbsrgits/DBIx-Class.git] / t / 83cache.t
index 2f4c036..9edfe71 100644 (file)
@@ -1,5 +1,5 @@
 use strict;
-use warnings;  
+use warnings;
 
 use Test::More;
 use lib qw(t/lib);
@@ -116,6 +116,7 @@ $rs = $schema->resultset("Artist")->search(
     prefetch => {
       cds => 'tags'
     },
+    order_by => { -desc => 'cds.cdid' },
   }
 );
 {
@@ -138,16 +139,9 @@ $artist = ($rs->all)[0];
 
 is($queries, 1, 'only one SQL statement executed');
 
-$schema->storage->debug($sdebug);
-$schema->storage->debugcb (undef);
-
-my @objs;
-#$artist = $rs->find(1);
-
 $queries = 0;
-$schema->storage->debug(1);
-$schema->storage->debugcb ($debugcb);
 
+my @objs;
 my $cds = $artist->cds;
 my $tags = $cds->next->tags;
 while( my $tag = $tags->next ) {
@@ -162,7 +156,7 @@ while( my $tag = $tags->next ) {
   push @objs, $tag->id; #warn "tag: ", $tag->ID;
 }
 
-is_deeply( \@objs, [ 1 ], 'second cd has correct tags' );
+is_deeply( [ sort @objs] , [ 2, 5, 8 ], 'third cd has correct tags' );
 
 $tags = $cds->next->tags;
 @objs = ();
@@ -170,7 +164,7 @@ while( my $tag = $tags->next ) {
   push @objs, $tag->id; #warn "tag: ", $tag->ID;
 }
 
-is_deeply( \@objs, [ 2, 5, 8 ], 'third cd has correct tags' );
+is_deeply( \@objs, [ 1 ], 'second cd has correct tags' );
 
 is( $queries, 0, 'no additional SQL statements while checking nested data' );