1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
11 my $schema = DBICTest->init_schema();
14 my $debugcb = sub { $queries++; };
15 my $orig_debug = $schema->storage->debug;
19 $schema->storage->debugcb($debugcb);
20 $schema->storage->debug(1);
22 my $cds_rs = $schema->resultset('CD')
23 ->search(\'0 = 1', { prefetch => 'tracks', cache => 1 });
25 my @cds = $cds_rs->all;
26 is( $queries, 1, '->all on empty original resultset hit db' );
27 is_deeply( $cds_rs->get_cache, [], 'empty cache on original resultset' );
28 is( 0+@cds, 0, 'empty original resultset' );
30 my $tracks_rs = $cds_rs->related_resultset('tracks');
31 is_deeply( $tracks_rs->get_cache, [], 'empty cache on related resultset' );
33 my @tracks = $tracks_rs->all;
34 is( $queries, 1, "->all on empty related resultset didn't hit db" );
35 is( 0+@tracks, 0, 'empty related resultset' );
37 $schema->storage->debugcb(undef);
38 $schema->storage->debug($orig_debug);