Probably avoids some potential page/search bugs
[dbsrgits/DBIx-Class.git] / t / run / 12pg.tl
CommitLineData
0567538f 1sub run_tests {
2
3my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
4
5#warn "$dsn $user $pass";
6
7plan skip_all, 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
b6b65a3e 8 . ' (note: creates and drops a table named artist!)' unless ($dsn && $user);
0567538f 9
b6b65a3e 10plan tests => 2;
0567538f 11
3712e4f4 12DBICTest->class("Schema")->compose_connection('PgTest' => $dsn, $user, $pass);
0567538f 13
14my $dbh = PgTest::Artist->storage->dbh;
15
0567538f 16$dbh->do("CREATE TABLE artist (artistid serial PRIMARY KEY, name VARCHAR(255));");
17
18PgTest::Artist->load_components('PK::Auto::Pg');
19
20my $new = PgTest::Artist->create({ name => 'foo' });
21
b6b65a3e 22is($new->artistid, 1, "Auto-PK worked");
23
24$new = PgTest::Artist->create({ name => 'bar' });
25
26is($new->artistid, 2, "Auto-PK worked");
27
28$dbh->do("DROP TABLE artist;");
0567538f 29
30}
31
321;