X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F61findnot.t;h=89070ce6e9cbce592a56a204e97967c89f7753e4;hb=7cb3585200c48fdf62e6be033517497ce792709b;hp=7a539d64a8527b9019310f96cd91be94b11ee0d0;hpb=5e0e5426b36b5df5f9d1394068cd9f7f1c81087a;p=dbsrgits%2FDBIx-Class.git diff --git a/t/61findnot.t b/t/61findnot.t index 7a539d6..89070ce 100644 --- a/t/61findnot.t +++ b/t/61findnot.t @@ -47,8 +47,10 @@ ok(@cd && !defined($cd[0]), 'Array contains an undef as only element'); $cd = $schema->resultset("CD")->first; my $artist_rs = $schema->resultset("Artist")->search({ artistid => $cd->artist->artistid }); -$art = $artist_rs->find({ name => 'some other name' }, { key => 'primary' }); -ok($art, 'Artist found by key in the resultset'); +for my $key ('', 'primary') { + my $art = $artist_rs->find({ name => 'some other name' }, { $key ? (key => $key) : () }); + is($art->artistid, $cd->get_column('artist'), "Artist found through @{[ $key ? 'explicit' : 'implicit' ]} key locked in the resultset"); +} # collapsing and non-collapsing are separate codepaths, thus the separate tests @@ -65,6 +67,7 @@ throws_ok { } qr/Unable to satisfy requested constraint 'primary'/; for (1, 0) { + local $ENV{DBIC_NULLABLE_KEY_NOWARN}; warnings_like sub { $artist_rs->find({ artistid => undef }, { key => 'primary' })