9 my $schema = DBICTest->init_schema();
11 my $cd_rs = $schema->resultset('CD')->search ({genreid => { '!=', undef } }, { order_by => 'cdid' });
12 my $track_cnt = $cd_rs->search({}, { rows => 1 })->search_related ('tracks')->count;
14 my %basecols = $cd_rs->first->get_columns;
16 # the current implementation of get_inflated_columns will "inflate"
17 # relationships by simply calling the accessor, when you have
18 # identically named columns and relationships (you shouldn't anyway)
19 # I consider this wrong, but at the same time appreciate the
20 # ramifications of changing this. Thus the value override and the
21 # TODO to go with it. Delete all of this if ever resolved.
22 my %todo_rel_inflation_override = ( artist => $basecols{artist} );
24 local $TODO = 'Treating relationships as inflatable data is wrong - see comment in ' . __FILE__;
25 ok (! keys %todo_rel_inflation_override);
28 my $plus_rs = $cd_rs->search (
30 { join => 'tracks', distinct => 1, '+select' => { count => 'tracks.trackid' }, '+as' => 'tr_cnt' },
34 { $plus_rs->first->get_columns },
35 { %basecols, tr_cnt => $track_cnt },
36 'extra columns returned by get_columns',
40 { $plus_rs->first->get_inflated_columns, %todo_rel_inflation_override },
41 { %basecols, tr_cnt => $track_cnt },
42 'extra columns returned by get_inflated_columns without inflatable columns',
47 "+select/get_inflated_columns tests need " . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt'),
49 ) unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt');
51 $schema->class('CD')->inflate_column( 'year',
52 { inflate => sub { DateTime->new( year => shift ) },
53 deflate => sub { shift->year } }
56 $basecols{year} = DateTime->new ( year => $basecols{year} );
59 { $plus_rs->first->get_inflated_columns, %todo_rel_inflation_override },
60 { %basecols, tr_cnt => $track_cnt },
61 'extra columns returned by get_inflated_columns',