1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
10 my $schema = DBICTest->init_schema( no_populate => 1 );
12 my $t11 = $schema->resultset('Track')->find_or_create({
14 title => 'Track one cd one',
18 very_long_artist_relationship => {
24 my $t12 = $schema->resultset('Track')->find_or_create({
26 title => 'Track two cd one',
29 very_long_artist_relationship => {
35 # FIXME - MC should be smart enough to infer this on its own...
36 $schema->resultset('Artist')->create({ name => 'Artist two' });
38 my $t2 = $schema->resultset('Track')->find_or_create({
40 title => 'Track one cd one',
44 very_long_artist_relationship => {
51 $schema->resultset('Artist')->search({}, {
52 prefetch => { cds => 'tracks' },
53 order_by => 'tracks.title',
56 { artistid => 1, charfield => undef, name => "Artist one", rank => 13, cds => [
57 { artist => 1, cdid => 1, genreid => undef, single_track => undef, title => "CD one", year => 1, tracks => [
58 { cd => 1, last_updated_at => undef, last_updated_on => undef, position => 1, title => "Track one cd one", trackid => 1 },
59 { cd => 1, last_updated_at => undef, last_updated_on => undef, position => 2, title => "Track two cd one", trackid => 2 },
62 { artistid => 2, charfield => undef, name => "Artist two", rank => 13, cds => [
63 { artist => 2, cdid => 2, genreid => undef, single_track => undef, title => "CD one", year => 1, tracks => [
64 { cd => 2, last_updated_at => undef, last_updated_on => undef, position => 1, title => "Track one cd one", trackid => 3 },
68 'Expected state of database after several find_or_create rounds'