1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
11 # More tests like this in t/prefetch/manual.t
13 my $schema = DBICTest->init_schema(no_populate => 1, quote_names => 1);
14 $schema->resultset('Artist')->create({ name => 'JMJ', cds => [{
15 title => 'Magnetic Fields',
17 genre => { name => 'electro' },
27 $schema->resultset('CD')->create({
30 artist => { name => 'JMJ' },
31 genre => { name => 'electro' },
42 artist => { name => 'JMJ' },
44 { title => 'o2', position => 2}, # the position should not be needed here, bug in MC
51 $schema->resultset('CD')->create({ artist => 1, year => 1977, title => "fuzzy_$_" });
55 package DBICTest::HRI::Subclass;
56 use base 'DBIx::Class::ResultClass::HashRefInflator';
60 package DBICTest::HRI::Around;
61 use base 'DBIx::Class::ResultClass::HashRefInflator';
63 sub inflate_result { shift->next::method(@_) }
67 $schema->resultset('CD')->search_rs({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' }),
68 $schema->resultset('CD')->search_rs({}, { result_class => 'DBICTest::HRI::Subclass' }),
69 $schema->resultset('CD')->search_rs({}, { result_class => 'DBICTest::HRI::Around' }),
76 'single_track.cd.artist.name' => 'artist.name',
78 join => { single_track => { cd => 'artist' } },
79 order_by => [qw/me.cdid artist.artistid/],
82 { year => 1981, single_track => undef },
83 { year => 1976, single_track => undef },
84 { year => 1978, single_track => {
86 artist => { name => "JMJ" }
89 { year => 1977, single_track => undef },
90 { year => 1977, single_track => undef },
93 'plain 1:1 descending chain ' . $rs->result_class
99 'artist' => 'me.artist',
100 'title' => 'me.title',
102 'single_track.cd.artist.artistid' => 'artist.artistid',
103 'single_track.cd.artist.cds.cdid' => 'cds.cdid',
104 'single_track.cd.artist.cds.tracks.title' => 'tracks.title',
106 join => { single_track => { cd => { artist => { cds => 'tracks' } } } },
107 order_by => [qw/me.cdid artist.artistid cds.cdid tracks.trackid/],
111 artist => 1, title => "Magnetic Fields", year => 1981, single_track => undef,
114 artist => 1, title => "Oxygene", year => 1976, single_track => undef,
117 artist => 1, title => "Equinoxe", year => 1978, single_track => {
120 artistid => 1, cds => {
121 cdid => 1, tracks => {
130 artist => 1, title => "Equinoxe", year => 1978, single_track => {
133 artistid => 1, cds => {
134 cdid => 1, tracks => {
143 artist => 1, title => "Equinoxe", year => 1978, single_track => {
146 artistid => 1, cds => {
147 cdid => 1, tracks => {
156 artist => 1, title => "Equinoxe", year => 1978, single_track => {
159 artistid => 1, cds => {
160 cdid => 1, tracks => {
169 artist => 1, title => "Equinoxe", year => 1978, single_track => {
172 artistid => 1, cds => {
173 cdid => 2, tracks => {
182 artist => 1, title => "Equinoxe", year => 1978, single_track => {
185 artistid => 1, cds => {
186 cdid => 2, tracks => {
195 artist => 1, title => "Equinoxe", year => 1978, single_track => {
198 artistid => 1, cds => {
199 cdid => 3, tracks => {
208 artist => 1, title => "Equinoxe", year => 1978, single_track => {
211 artistid => 1, cds => {
212 cdid => 3, tracks => {
221 artist => 1, title => "Equinoxe", year => 1978, single_track => {
224 artistid => 1, cds => {
225 cdid => 3, tracks => {
234 artist => 1, title => "Equinoxe", year => 1978, single_track => {
237 artistid => 1, cds => {
238 cdid => 4, tracks => undef
245 artist => 1, title => "Equinoxe", year => 1978, single_track => {
248 artistid => 1, cds => {
249 cdid => 5, tracks => undef
256 artist => 1, title => "fuzzy_1", year => 1977, single_track => undef,
259 artist => 1, title => "fuzzy_2", year => 1977, single_track => undef,
262 'non-collapsing 1:1:1:M:M chain ' . $rs->result_class,
268 'artist' => 'me.artist',
269 'title' => 'me.title',
271 'single_track.cd.artist.artistid' => 'artist.artistid',
272 'single_track.cd.artist.cds.cdid' => 'cds.cdid',
273 'single_track.cd.artist.cds.tracks.title' => 'tracks.title',
275 join => { single_track => { cd => { artist => { cds => 'tracks' } } } },
276 order_by => [qw/me.cdid artist.artistid cds.cdid tracks.trackid/],
281 artist => 1, title => "Magnetic Fields", year => 1981, single_track => undef,
284 artist => 1, title => "Oxygene", year => 1976, single_track => undef,
287 artist => 1, title => "Equinoxe", year => 1978, single_track => {
290 artistid => 1, cds => [
292 cdid => 1, tracks => [
300 cdid => 2, tracks => [
306 cdid => 3, tracks => [
313 cdid => 4, tracks => [],
316 cdid => 5, tracks => [],
324 artist => 1, title => "fuzzy_1", year => 1977, single_track => undef,
327 artist => 1, title => "fuzzy_2", year => 1977, single_track => undef,
330 'collapsing 1:1:1:M:M chain ' . $rs->result_class,