X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F745db2.t;h=82475b18a633dbb682b9c24afe8a0e351f1518f6;hb=d4d46d1913b15af0536c4135a652ebcec967fde0;hp=82d3c2cbca60813be8902eb677766272d5a91dbe;hpb=c216324aa4b0f79ba056fbe74adbd735421e378a;p=dbsrgits%2FDBIx-Class.git diff --git a/t/745db2.t b/t/745db2.t index 82d3c2c..82475b1 100644 --- a/t/745db2.t +++ b/t/745db2.t @@ -14,27 +14,26 @@ plan skip_all => 'Set $ENV{DBICTEST_DB2_DSN}, _USER and _PASS to run this test' plan tests => 6; -DBICTest::Schema->compose_namespace('DB2Test' => $dsn, $user, $pass); +my $schema = DBICTest::Schema->connect($dsn, $user, $pass); -my $dbh = DB2Test->schema->storage->dbh; +my $dbh = $schema->storage->dbh; -$dbh->do("DROP TABLE artist", { RaiseError => 0, PrintError => 0 }); +eval { $dbh->do("DROP TABLE artist") }; $dbh->do("CREATE TABLE artist (artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), name VARCHAR(255), charfield CHAR(10));"); -#'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', ''); - -DB2Test::Artist->load_components('PK::Auto'); +# This is in core, just testing that it still loads ok +$schema->class('Artist')->load_components('PK::Auto'); # test primary key handling -my $new = DB2Test::Artist->create({ name => 'foo' }); +my $new = $schema->resultset('Artist')->create({ name => 'foo' }); ok($new->artistid, "Auto-PK worked"); # test LIMIT support for (1..6) { - DB2Test::Artist->create({ name => 'Artist ' . $_ }); + $schema->resultset('Artist')->create({ name => 'Artist ' . $_ }); } -my $it = DB2Test::Artist->search( {}, +my $it = $schema->resultset('Artist')->search( {}, { rows => 3, order_by => 'artistid' } @@ -64,11 +63,10 @@ my $test_type_info = { }; -my $type_info = DB2Test->schema->storage->columns_info_for('artist'); +my $type_info = $schema->storage->columns_info_for('artist'); is_deeply($type_info, $test_type_info, 'columns_info_for - column data types'); - - # clean up our mess -$dbh->do("DROP TABLE artist"); - +END { + $dbh->do("DROP TABLE artist") if $dbh; +}