From: Matt S Trout Date: Mon, 8 Aug 2005 20:40:13 +0000 (+0000) Subject: MySQL Auto-PK test added X-Git-Tag: v0.03001~53 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08aa04147542b49156ac190fa249b26a7186a28a;p=dbsrgits%2FDBIx-Class.git MySQL Auto-PK test added --- diff --git a/t/11mysql.t b/t/11mysql.t new file mode 100644 index 0000000..e1b2ee5 --- /dev/null +++ b/t/11mysql.t @@ -0,0 +1,31 @@ +use lib qw(lib t/lib); +use DBICTest::Schema; + +use Test::More; + +my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}; + +warn "$dsn $user $pass"; + +plan skip_all, 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test' + unless ($dsn && $user); + +plan tests => 1; + +DBICTest::Schema->compose_connection('MySQLTest' => $dsn, $user, $pass); + +my $dbh = MySQLTest::Artist->storage->dbh; + +$dbh->do("DROP TABLE IF EXISTS artist;"); + +$dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255));"); + +#'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', ''); + +MySQLTest::Artist->load_components('PK::Auto::MySQL'); + +my $new = MySQLTest::Artist->create({ name => 'foo' }); + +ok($new->artistid, "Auto-PK worked"); + +1;