Delete basicrels tests. Modify run tests to use new syntax. Remove helperrels test...
[dbsrgits/DBIx-Class.git] / t / run / 21transactions.tl
index 798a76b..fe3c453 100644 (file)
@@ -1,6 +1,13 @@
-sub run_tests {
-my $schema = shift;
-plan tests => 37;
+use strict;
+use warnings;  
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest::init_schema();
+
+plan tests => 39;
 
 my $code = sub {
   my ($artist, @cd_titles) = @_;
@@ -13,6 +20,18 @@ my $code = sub {
   return $artist->cds->all;
 };
 
+# Test checking of parameters
+{
+  eval {
+    (ref $schema)->txn_do(sub{});
+  };
+  like($@, qr/class method/, '$self parameter check ok');
+  eval {
+    $schema->txn_do('');
+  };
+  like($@, qr/must be a CODE reference/, '$coderef parameter check ok');
+}
+
 # Test successful txn_do() - scalar context
 {
   my @titles = map {'txn_do test CD ' . $_} (1..5);
@@ -157,6 +176,4 @@ my $fail_code = sub {
   })->first;
   ok(!defined($cd), q{failed txn_do didn't add failed txn's cd});
 }
-}
 
-1;