my $schema = DBICTest->init_schema();
-plan tests => 68;
+plan tests => 69;
# has_a test
my $cd = $schema->resultset("CD")->find(4);
$track = $schema->resultset("Track")->create( {
trackid => 2,
cd => 3,
- position => 99,
title => 'Hidden Track 2'
} );
$track->update_from_related( cd => $cd );
-my $t_cd = ($schema->resultset("Track")->search( cd => 4, position => 99 ))[0]->cd;
+my $t_cd = ($schema->resultset("Track")->search( cd => 4, title => 'Hidden Track 2' ))[0]->cd;
is( $t_cd->cdid, 4, 'update_from_related ok' );
$undef_artist_cd->related_resultset('artist')->new({name => 'foo'});
};
is( $@, '', "Object created on a resultset related to not yet inserted object");
-
+lives_ok{
+ $schema->resultset('Artwork')->new_result({})->cd;
+} 'undef_on_null_fk does not choke on empty conds';
+
my $def_artist_cd = $schema->resultset("CD")->new_result({ 'title' => 'badgers', 'year' => 2007, artist => undef });
is($def_artist_cd->has_column_loaded('artist'), 1, 'FK loaded');
is($def_artist_cd->search_related('artist')->count, 0, 'closed search on null FK');