From: Anders Nor Berle Date: Tue, 25 Mar 2008 04:03:32 +0000 (+0000) Subject: Back all savepoint tests out of (mysql|pg).t X-Git-Tag: v0.08240~499 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=34a9e8a0a9f44db29f4faabd7a37d40a58ed0821;p=dbsrgits%2FDBIx-Class.git Back all savepoint tests out of (mysql|pg).t There's not a dire need to have them there, the only thing they would be testing are the ->_svp_* methods on Storage, which are tested in 98savepoints.t anyway. I kept the changes in 72pg.t that was neccesary for it to run to completion though. --- diff --git a/t/71mysql.t b/t/71mysql.t index 8f8d1db..a326dda 100644 --- a/t/71mysql.t +++ b/t/71mysql.t @@ -1,11 +1,10 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); use DBICTest; use DBI::Const::GetInfoType; -use DBICTest::Stats; my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}; @@ -14,18 +13,15 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}; plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test' unless ($dsn && $user); -plan tests => 7; +plan tests => 5; my $schema = DBICTest::Schema->connect($dsn, $user, $pass); my $dbh = $schema->storage->dbh; -my $stats = new DBICTest::Stats(); -$schema->storage->debugobj($stats); -$schema->storage->debug(1); $dbh->do("DROP TABLE IF EXISTS artist;"); -$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), charfield CHAR(10)) ENGINE=InnoDB;"); +$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), charfield CHAR(10));"); #'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', ''); @@ -72,28 +68,6 @@ my $test_type_info = { }, }; -$schema->txn_begin; - -my $arty = $schema->resultset('Artist')->find(1); - -my $name = $arty->name; - -$schema->storage->_svp_begin ("mysavepoint"); - -$arty->update({ name => 'Jheephizzy' }); - -$arty->discard_changes; - -cmp_ok($arty->name, 'eq', 'Jheephizzy', 'Name changed'); - -$schema->storage->_svp_rollback ("mysavepoint"); - -$arty->discard_changes; - -cmp_ok($arty->name, 'eq', $name, 'Name rolled back'); - -$schema->txn_commit; - SKIP: { my $mysql_version = $dbh->get_info( $GetInfoType{SQL_DBMS_VER} ); skip "Cannot determine MySQL server version", 1 if !$mysql_version; diff --git a/t/72pg.t b/t/72pg.t index 512b7b9..0003205 100644 --- a/t/72pg.t +++ b/t/72pg.t @@ -4,7 +4,6 @@ use warnings; use Test::More; use lib qw(t/lib); use DBICTest; -use DBICTest::Stats; { package DBICTest::Schema::Casecheck; @@ -28,10 +27,10 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/}; plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test' . ' (note: creates and drops tables named artist and casecheck!)' unless ($dsn && $user); -plan tests => 34; +plan tests => 32; DBICTest::Schema->load_classes( 'Casecheck' ); -my $schema = DBICTest::Schema->connect($dsn, $user, $pass, { auto_savepoint => 1}); +my $schema = DBICTest::Schema->connect($dsn, $user, $pass); # Check that datetime_parser returns correctly before we explicitly connect. SKIP: { @@ -46,10 +45,6 @@ SKIP: { } my $dbh = $schema->storage->dbh; -my $stats = new DBICTest::Stats(); -$schema->storage->debugobj($stats); -$schema->storage->debug(1); - $schema->source("Artist")->name("testschema.artist"); $schema->source("SequenceTest")->name("testschema.sequence_test"); $dbh->do("CREATE SCHEMA testschema;"); @@ -188,8 +183,8 @@ SKIP: { SKIP: { skip "Oracle Auto-PK tests are broken", 16; + # test auto increment using sequences WITHOUT triggers - for (1..5) { my $st = $schema->resultset('SequenceTest')->create({ name => 'foo' }); is($st->pkid1, $_, "Oracle Auto-PK without trigger: First primary key"); @@ -200,28 +195,6 @@ SKIP: { is($st->pkid1, 55, "Oracle Auto-PK without trigger: First primary key set manually"); } -$schema->txn_begin; - -my $arty = $schema->resultset('Artist')->find(1); - -my $name = $arty->name; - -$schema->storage->_svp_begin ("mysavepoint"); - -$arty->update({ name => 'Jheephizzy' }); - -$arty->discard_changes; - -cmp_ok($arty->name, 'eq', 'Jheephizzy', 'Name changed'); - -$schema->storage->_svp_rollback ("mysavepoint"); - -$arty->discard_changes; - -cmp_ok($arty->name, 'eq', $name, 'Name rolled back'); - -$schema->txn_commit; - END { if($dbh) { $dbh->do("DROP TABLE testschema.artist;");