Reduce to a warning the find-with-NULL-key exception from b7743dab
[dbsrgits/DBIx-Class.git] / t / 61findnot.t
index 6d23dc9..d7dde4d 100644 (file)
@@ -52,19 +52,37 @@ 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 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 requested constraint 'primary'/;