Mark forgotten ::Row::id() method as indirect_sugar
[dbsrgits/DBIx-Class.git] / t / prefetch / false_colvalues.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use warnings;
4 use strict;
5
6 use Test::More;
7 use Test::Deep;
8
9
10 use DBICTest;
11
12 my $schema = DBICTest->init_schema( no_populate => 1 );
13
14 $schema->resultset('CD')->create({
15   cdid => 0, title => '', year => 0, genreid => 0, single_track => 0, artist => {
16     artistid => 0, name => '', rank => 0, charfield => 0,
17   },
18 });
19
20 $schema->is_executed_querycount( sub {
21   my $cd = $schema->resultset('CD')->search( {}, { prefetch => 'artist' })->next;
22
23   cmp_deeply
24     { $cd->get_columns },
25     { artist => 0, cdid => 0, genreid => 0, single_track => 0, title => '', year => 0 },
26     'Expected CD columns present',
27   ;
28
29   cmp_deeply
30     { $cd->artist->get_columns },
31     { artistid => 0, charfield => 0, name => "", rank => 0 },
32     'Expected Artist columns present',
33   ;
34 }, 1, 'Only one query fired - prefetch worked' );
35
36 done_testing;