1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
11 sub mc_diag { diag (@_) if $ENV{DBIC_MULTICREATE_DEBUG} };
13 my $schema = DBICTest->init_schema();
16 * Try a diamond multicreate
18 Artist -> has_many -> Artwork_to_Artist -> belongs_to
20 belongs_to <- CD <- belongs_to <- Artwork <-/
27 $schema->resultset ('Artist')->create ({
28 name => 'The wooled wolf',
29 artwork_to_artist => [{
32 title => 'Wool explosive',
34 artist => { name => 'The black exploding sheep' },
40 my $art2 = $schema->resultset ('Artist')->find ({ name => 'The black exploding sheep' });
41 ok ($art2, 'Second artist exists');
43 my $cd = $art2->cds->single;
44 is ($cd->title, 'Wool explosive', 'correctly created CD');
47 [ $cd->artwork->artists->get_column ('name')->all ],
48 [ 'The wooled wolf' ],
49 'Artist correctly attached to artwork',
52 }, 'Diamond chain creation ok');