X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F61findnot.t;h=d7dde4db5a881f96a44d32ba28f7792e15bb35ed;hb=79adc44f8b50de05a1d31f9b3d4a64b137c7d0d8;hp=e7f4249a8e7cc8843accfa42fb45c53575601396;hpb=b7743dabe3354b4a43954ec44a226dc1c44722ac;p=dbsrgits%2FDBIx-Class.git diff --git a/t/61findnot.t b/t/61findnot.t index e7f4249..d7dde4d 100644 --- a/t/61findnot.t +++ b/t/61findnot.t @@ -52,21 +52,39 @@ ok($art, 'Artist found by key in the resultset'); # collapsing and non-collapsing are separate codepaths, thus the separate tests + $artist_rs = $schema->resultset("Artist"); + warnings_exist { $artist_rs->find({}) } qr/\QDBIx::Class::ResultSet::find(): Query returned more than one row. SQL that returns multiple rows is DEPRECATED for ->find and ->single/ => "Non-unique find generated a cursor inexhaustion warning"; + throws_ok { $artist_rs->find({}, { key => 'primary' }) -} qr/Unable to satisfy constraint 'primary'/; +} qr/Unable to satisfy requested constraint 'primary'/; + +for (1, 0) { + warnings_like + sub { + $artist_rs->find({ artistid => undef }, { key => 'primary' }) + }, + $_ ? [ + qr/undef values supplied for requested unique constraint.+almost certainly not what you wanted/, + ] : [], + 'One warning on NULL conditions for constraint' + ; +} + $artist_rs = $schema->resultset("Artist")->search({}, { prefetch => 'cds' }); + warnings_exist { $artist_rs->find({}) } qr/\QDBIx::Class::ResultSet::find(): Query returned more than one row/, "Non-unique find generated a cursor inexhaustion warning"; + throws_ok { $artist_rs->find({}, { key => 'primary' }) -} qr/Unable to satisfy constraint 'primary'/; +} qr/Unable to satisfy requested constraint 'primary'/; done_testing;