sub mc_diag { diag (@_) if $ENV{DBIC_MULTICREATE_DEBUG} };
-plan tests => 77;
+plan tests => 84;
my $schema = DBICTest->init_schema();
isa_ok($cd->artist, 'DBICTest::Artist', 'Created related Artist');
is($cd->artist->name, 'Fred Bloggs', 'Artist created correctly');
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* same as above but the child and parent have no values, except for an explicit parent pk';
eval {
'Bookmark and link made it to the DB',
);
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* create over > 1 levels of has_many create (A => { has_many => { B => has_many => C } } )';
eval {
is($cd->tags->first->tag, 'rock', 'Tag created correctly');
};
-mc_diag $@ if $@;
+diag $@ if $@;
throws_ok (
sub {
is ($cd->tracks->count, 3, 'CD has 3 tracks');
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag (<<'DG');
* Create over > 1 levels of might_have with multiple has_many and multiple m2m
'Producers named correctly',
);
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag (<<'DG');
* Same as above but starting at the might_have directly
'Producers named correctly',
);
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* Test might_have again but with a PK == FK in the middle (obviously not specified)';
eval {
'Images named correctly after search',
);
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* Test might_have again but with just a PK and FK (neither specified) in the mid-table';
eval {
'Lyrics text via search matches',
);
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag (<<'DG');
* Test a multilevel might-have with a PK == FK in the might_have/has_many table
'Artists named correctly queried via a new search',
);
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* Nested find_or_create';
eval {
});
is($newartist2->name, 'Fred 3', 'Created new artist with cds via find_or_create');
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* Multiple same level has_many create';
eval {
is($artist2->in_storage, 1, 'artist with duplicate rels inserted okay');
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* First create_related pass';
eval {
ok( $track && ref $track eq 'DBICTest::Track', 'Got Expected Track Class');
}
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* second create_related with same arguments';
eval {
ok( $track && ref $track eq 'DBICTest::Track', 'Got Expected Track Class');
}
};
-mc_diag $@ if $@;
+diag $@ if $@;
mc_diag '* create of parents of a record linker table';
eval {
});
ok($cdp, 'join table record created ok');
};
-mc_diag $@ if $@;
+diag $@ if $@;
eval {
my $kurt_cobain = { name => 'Kurt Cobain' };
is($a->cds && $a->cds->first && $a->cds->first->title,
'In Utero', 'CD insertion ok');
};
-mc_diag $@ if $@;
+diag $@ if $@;
=pod
# This test case has been moved to t/96multi_create/cd_single.t
is($a->name, 'Pink Floyd', 'Artist insertion ok');
is($a->cds && $a->cds->first->title, 'The Wall', 'CD insertion ok');
};
-mc_diag $@ if $@;
+diag $@ if $@;
=cut
mc_diag '* Create foreign key col obj including PK (See test 20 in 66relationships.t)';
my $new_cd = $schema->resultset("CD")->create($new_cd_hashref);
is($new_cd->artist->id, 17, 'new id retained okay');
};
-mc_diag $@ if $@;
+diag $@ if $@;
eval {
$schema->resultset("CD")->create({