From: Matt S Trout Date: Mon, 26 Dec 2005 00:48:44 +0000 (+0000) Subject: 04db test now uses txn_* API rather than storage->dbh hacks X-Git-Tag: v0.05005~119^2~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e88a60b6d5b006170cdc5dc85a8f9a1735442c59;p=dbsrgits%2FDBIx-Class.git 04db test now uses txn_* API rather than storage->dbh hacks --- diff --git a/t/run/04db.tl b/t/run/04db.tl index d46c656..1f07da7 100644 --- a/t/run/04db.tl +++ b/t/run/04db.tl @@ -1,41 +1,29 @@ sub run_tests { -plan tests => 3; +plan tests => 2; # add some rows inside a transaction and commit it # XXX: Is storage->dbh the only way to get a dbh? -DBICTest::Artist->storage->dbh->{AutoCommit} = 0; +DBICTest::Artist->txn_begin; for (10..15) { DBICTest::Artist->create( { artistid => $_, name => "artist number $_", } ); } -DBICTest::Artist->dbi_commit; +DBICTest::Artist->txn_commit; my ($artist) = DBICTest::Artist->find(15); is($artist->name, 'artist number 15', "Commit ok"); -# repeat the test using AutoCommit = 1 to force the commit -DBICTest::Artist->storage->dbh->{AutoCommit} = 0; -for (16..20) { - DBICTest::Artist->create( { - artistid => $_, - name => "artist number $_", - } ); -} -DBICTest::Artist->storage->dbh->{AutoCommit} = 1; -($artist) = DBICTest::Artist->find(20); -is($artist->name, 'artist number 20', "Commit using AutoCommit ok"); - # add some rows inside a transaction and roll it back -DBICTest::Artist->storage->dbh->{AutoCommit} = 0; +DBICTest::Artist->txn_begin; for (21..30) { DBICTest::Artist->create( { artistid => $_, name => "artist number $_", } ); } -DBICTest::Artist->dbi_rollback; +DBICTest::Artist->txn_rollback; ($artist) = DBICTest::Artist->search( artistid => 25 ); is($artist, undef, "Rollback ok");