? "at the same level (${as_prefix}) "
: "at top level "
)
- . 'will currently disrupt both the functionality of $rs->count(), '
- . 'and the amount of objects retrievable via $rs->next(). '
+ . 'will explode the number of row objects retrievable via ->next or ->all. '
. 'Use at your own risk.'
);
}
? "at the same level (${as_prefix}) "
: "at top level "
)
- . 'will currently disrupt both the functionality of $rs->count(), '
- . 'and the amount of objects retrievable via $rs->next(). '
+ . 'will explode the number of row objects retrievable via ->next or ->all. '
. 'Use at your own risk.'
);
}
use DBICTest;
use Data::Dumper;
-my $schema = DBICTest->init_schema();
+plan tests => 10;
-my $orig_debug = $schema->storage->debug;
+my $schema = DBICTest->init_schema();
use IO::File;
-BEGIN {
- eval "use DBD::SQLite";
- plan $@
- ? ( skip_all => 'needs DBD::SQLite for testing' )
- : ( tests => 16 );
-}
-
# once the following TODO is complete, remove the 2 warning tests immediately
# after the TODO block
# (the TODO block itself contains tests ensuring that the warns are removed)
}
# remove this closure once the TODO above is working
-my $w;
{
- local $SIG{__WARN__} = sub { $w = shift };
+ my $warn_re = qr/will explode the number of row objects retrievable via/;
+
+ my (@w, @dummy);
+ local $SIG{__WARN__} = sub { $_[0] =~ $warn_re ? push @w, @_ : warn @_ };
my $rs = $schema->resultset('CD')->search ({ 'me.title' => 'Forkful of bees' }, { prefetch => [qw/tracks tags/] });
- for (qw/all count next first/) {
- undef $w;
- my @stuff = $rs->search()->$_;
- like ($w, qr/will currently disrupt both the functionality of .rs->count\(\), and the amount of objects retrievable via .rs->next\(\)/,
- "warning on ->$_ attempt prefetching several same level has_manys (1 -> M + M)");
- }
+ @w = ();
+ @dummy = $rs->first;
+ is (@w, 1, 'warning on attempt prefetching several same level has_manys (1 -> M + M)');
+
my $rs2 = $schema->resultset('LinerNotes')->search ({ notes => 'Buy Whiskey!' }, { prefetch => { cd => [qw/tags tracks/] } });
- for (qw/all count next first/) {
- undef $w;
- my @stuff = $rs2->search()->$_;
- like ($w, qr/will currently disrupt both the functionality of .rs->count\(\), and the amount of objects retrievable via .rs->next\(\)/,
- "warning on ->$_ attempt prefetching several same level has_manys (M -> 1 -> M + M)");
- }
+ @w = ();
+ @dummy = $rs2->first;
+ is (@w, 1, 'warning on attempt prefetching several same level has_manys (M -> 1 -> M + M)');
}
__END__