summaryrefslogtreecommitdiff
path: root/t/65transact.t
diff options
context:
space:
mode:
Diffstat (limited to 't/65transact.t')
-rw-r--r--t/65transact.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/65transact.t b/t/65transact.t
new file mode 100644
index 0000000..f3d672b
--- /dev/null
+++ b/t/65transact.t
@@ -0,0 +1,35 @@
+#!perl -w
+$|=1;
+
+use strict;
+
+use DBI;
+
+use Test::More;
+
+plan skip_all => 'Transactions not supported by DBD::Gofer'
+ if $ENV{DBI_AUTOPROXY} && $ENV{DBI_AUTOPROXY} =~ /^dbi:Gofer/i;
+
+plan tests => 10;
+
+my $dbh = DBI->connect('dbi:ExampleP(AutoCommit=>1):', undef, undef)
+ or die "Unable to connect to ExampleP driver: $DBI::errstr";
+
+print "begin_work...\n";
+ok($dbh->{AutoCommit});
+ok(!$dbh->{BegunWork});
+
+ok($dbh->begin_work);
+ok(!$dbh->{AutoCommit});
+ok($dbh->{BegunWork});
+
+$dbh->commit;
+ok($dbh->{AutoCommit});
+ok(!$dbh->{BegunWork});
+
+ok($dbh->begin_work({}));
+$dbh->rollback;
+ok($dbh->{AutoCommit});
+ok(!$dbh->{BegunWork});
+
+1;