X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fprefetch%2Flazy_cursor.t;h=de6e9361e379c71a32652023b2f668cfe3bf941a;hb=ab314234bf2ad136f2d6daaf48294139ffc985ee;hp=5f9679645fe2bb783345a6470a814922600d65fd;hpb=56653891210c588f8b894ef4968ac6476ca3325d;p=dbsrgits%2FDBIx-Class.git diff --git a/t/prefetch/lazy_cursor.t b/t/prefetch/lazy_cursor.t index 5f96796..de6e936 100644 --- a/t/prefetch/lazy_cursor.t +++ b/t/prefetch/lazy_cursor.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More; +use Test::Warn; use Test::Exception; use lib qw(t/lib); use DBICTest; @@ -64,10 +65,25 @@ is ( ($rs->cursor->next)[0], 1, 'Cursor auto-rewound after all()'); is ($rs->{_stashed_rows}, undef, 'Nothing else left in $rs stash'); my $unordered_rs = $rs->search({}, { order_by => 'cds.title' }); -ok ($unordered_rs->next, 'got row 1'); + +warnings_exist { + ok ($unordered_rs->next, 'got row 1'); +} qr/performed an eager cursor slurp underneath/, 'Warned on auto-eager cursor'; + is_deeply ([$unordered_rs->cursor->next], [], 'Nothing left on cursor, eager slurp'); ok ($unordered_rs->next, "got row $_") for (2 .. $initial_artists_cnt + 3); is ($unordered_rs->next, undef, 'End of RS reached'); is ($unordered_rs->next, undef, 'End of RS not lost'); +{ + my $non_uniquely_ordered_constrained = $schema->resultset('CD')->search( + { artist => 1 }, + { order_by => [qw( me.genreid me.title me.year )], prefetch => 'tracks' }, + ); + + isa_ok ($non_uniquely_ordered_constrained->next, 'DBICTest::CD' ); + + ok( defined $non_uniquely_ordered_constrained->cursor->next, 'Cursor not exhausted' ); +} + done_testing;