use Test::More;
use Test::Exception;
+use Test::Warn;
use lib qw(t/lib);
use DBICTest;
-plan tests => 91;
-
my $schema = DBICTest->init_schema();
lives_ok ( sub {
$kurt_cobain->{cds} = [ $in_utero ];
+ warnings_exist {
+ $schema->resultset('Artist')->populate([ $kurt_cobain ]);
+ } qr/\QFast-path populate() with supplied related objects is not possible/;
+
- $schema->resultset('Artist')->populate([ $kurt_cobain ]); # %)
my $artist = $schema->resultset('Artist')->find({name => 'Kurt Cobain'});
is($artist->name, 'Kurt Cobain', 'Artist insertion ok');
#$t->cd($t->new_related('cd', { artist => undef } ) );
#$t->{_rel_in_storage} = 0;
$t->insert;
-}, qr/cd.artist may not be NULL/, "Exception propogated properly");
+}, qr/DBI Exception.+(?x:
+ \QNOT NULL constraint failed: cd.artist\E
+ |
+ \Qcd.artist may not be NULL\E
+)/s, "Exception propogated properly");
lives_ok ( sub {
$schema->resultset('CD')->create ({
is ($m2m_cd->first->producers->first->name, 'Cowboy Neal', 'Correct producer row created');
}, 'Test multi create over many_to_many');
-1;
+done_testing;