fixup for stringify that can be false in find_or_create_related
[dbsrgits/DBIx-Class.git] / t / run / 01core.tl
index 9ef60a0..68d34aa 100644 (file)
@@ -1,7 +1,7 @@
 sub run_tests {
 my $schema = shift;
 
-plan tests => 44; 
+plan tests => 47;
 
 # figure out if we've got a version of sqlite that is older than 3.2.6, in
 # which case COUNT(DISTINCT()) doesn't work
@@ -181,6 +181,25 @@ cmp_ok($tag->has_column_loaded('tag'), '==', 0, 'Has not tag  loaded');
 
 ok($schema->storage(), 'Storage available');
 
+{
+  my $rs = $schema->resultset("Artist")->search({
+    -and => [
+      artistid => { '>=', 1 },
+      artistid => { '<', 3 }
+    ]
+  });
+
+  $rs->update({ name => 'Test _cond_for_update_delete' });
+
+  my $art;
+
+  $art = $schema->resultset("Artist")->find(1);
+  is($art->name, 'Test _cond_for_update_delete', 'updated first artist name');
+
+  $art = $schema->resultset("Artist")->find(2);
+  is($art->name, 'Test _cond_for_update_delete', 'updated second artist name');
+}
+
 #test cascade_delete thru many_many relations
 my $art_del = $schema->resultset("Artist")->find({ artistid => 1 });
 $art_del->delete;
@@ -194,6 +213,14 @@ is($typeinfo->{data_type}, 'INTEGER', 'column_info ok');
 $schema->source("Artist")->column_info('artistid');
 ok($schema->source("Artist")->{_columns_info_loaded} == 1, 'Columns info flag set');
 
+my $newbook = $schema->resultset( 'Bookmark' )->find(1);
+
+$@ = '';
+eval {
+my $newlink = $newbook->link;
+};
+ok(!$@, "stringify to false value doesn't cause error");
+
 }
 
 1;