1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
11 # From http://lists.scsys.co.uk/pipermail/dbix-class/2013-February/011119.html
13 # > Right, at this point we have an "undefined situation turned into an
14 # > unplanned feature", therefore 0.08242 will downgrade the exception to a
15 # > single-warning-per-process. This seems like a sane middle ground for
16 # > "you gave me an 'as' that worked by accident before - fix it at your
19 # When the things were reshuffled it became apparent implementing a warning
20 # for the HRI case *only* is going to complicate the code a lot, without
21 # adding much benefit at this point. So just make sure everything works the
22 # way it used to and move on
25 my $s = DBICTest->init_schema;
27 my $rs_2nd_track = $s->resultset('Track')->search(
28 { 'me.position' => 2 },
30 join => { cd => 'artist' },
31 columns => [ 'me.title', { 'artist.cdtitle' => 'cd.title' }, 'artist.name' ],
32 order_by => [ 'artist.name', { -desc => 'cd.cdid' }, 'me.trackid' ],
37 [ map { $_->[-1] } $rs_2nd_track->cursor->all ],
38 [ ('Caterwauler McCrae') x 3, 'Random Boy Band', 'We Are Goth' ],
39 'Artist name cartesian product correct off cursor',
43 $rs_2nd_track->all_hri,
46 artist => { cdtitle => "Caterwaulin' Blues", name => "Caterwauler McCrae" },
50 artist => { cdtitle => "Forkful of bees", name => "Caterwauler McCrae" },
54 artist => { cdtitle => "Spoonful of bees", name => "Caterwauler McCrae" },
58 artist => { cdtitle => "Generic Manufactured Singles", name => "Random Boy Band" },
59 title => "Boring Song"
62 artist => { cdtitle => "Come Be Depressed With Us", name => "We Are Goth" },
63 title => "Under The Weather"
66 'HRI with invalid inflate map works'
70 { $rs_2nd_track->next }
71 qr!\QInflation into non-existent relationship 'artist' of 'Track' requested, check the inflation specification (columns/as) ending in '...artist.name'!,
72 'Correct exception on illegal ::Row inflation attempt'
75 # make sure has_many column redirection does not do weird stuff when collapse is requested
80 for my $col_and_join_args (
81 { '+columns' => { 'cd_title' => 'cds_2.title' }, join => [ 'cds', 'cds' ] },
82 { '+columns' => { 'cd_title' => 'cds.title' }, join => 'cds' },
83 { '+columns' => { 'cd_gr_name' => 'genre.name' }, join => { cds => 'genre' } },
85 for my $call (qw(next all first)) {
87 my $weird_rs = $s->resultset('Artist')->search({}, {
88 %$col_and_join_args, %$pref_args,
93 qr/\QResult collapse not possible - selection from a has_many source redirected to the main object/