use lib qw(t/lib);
use DBICTest;
-my $schema = DBICTest::init_schema();
+my $schema = DBICTest->init_schema();
-plan tests => 39;
+plan tests => 40;
my $code = sub {
my ($artist, @cd_titles) = @_;
eval {
(ref $schema)->txn_do(sub{});
};
- like($@, qr/class method/, '$self parameter check ok');
+ like($@, qr/storage/, "can't call txn_do without storage");
eval {
$schema->txn_do('');
};
# Force txn_rollback() to throw an exception
no warnings 'redefine';
no strict 'refs';
- local *{"DBIx::Class::Schema::txn_rollback"} = sub{die 'FAILED'};
+ local *{"DBIx::Class::Storage::DBI::SQLite::txn_rollback"} = sub{die 'FAILED'};
eval {
$schema->txn_do($fail_code, $artist);
ok(!defined($cd), q{failed txn_do didn't add failed txn's cd});
}
+# Grab a new schema to test txn before connect
+{
+ my $schema2 = DBICTest->init_schema(no_deploy => 1);
+ eval {
+ $schema2->txn_begin();
+ $schema2->txn_begin();
+ };
+ my $err = $@;
+ ok(($err eq ''), 'Pre-connection nested transactions.');
+}