Commit | Line | Data |
08aa0414 |
1 | use lib qw(lib t/lib); |
2 | use DBICTest::Schema; |
3 | |
4 | use Test::More; |
5 | |
6 | my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/}; |
7 | |
cba994a1 |
8 | #warn "$dsn $user $pass"; |
08aa0414 |
9 | |
10 | plan skip_all, 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test' |
11 | unless ($dsn && $user); |
12 | |
13 | plan tests => 1; |
14 | |
15 | DBICTest::Schema->compose_connection('MySQLTest' => $dsn, $user, $pass); |
16 | |
17 | my $dbh = MySQLTest::Artist->storage->dbh; |
18 | |
19 | $dbh->do("DROP TABLE IF EXISTS artist;"); |
20 | |
21 | $dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255));"); |
22 | |
23 | #'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', ''); |
24 | |
25 | MySQLTest::Artist->load_components('PK::Auto::MySQL'); |
26 | |
27 | my $new = MySQLTest::Artist->create({ name => 'foo' }); |
28 | |
29 | ok($new->artistid, "Auto-PK worked"); |
30 | |
31 | 1; |