X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F03insert.t;h=e2fb0339e85436b24611b6d0b4ddda9a331510ea;hb=0906c32bc963c9cdd0b55b2f0c608004375cff72;hp=275a753086de361af204365d3a478abdca8edca4;hpb=ebcd7e950dc50fd9529d2d59acd1fb9fb72e3916;p=dbsrgits%2FDBIx-Class-ResultSource-MultipleTableInheritance.git diff --git a/t/03insert.t b/t/03insert.t index 275a753..e2fb033 100644 --- a/t/03insert.t +++ b/t/03insert.t @@ -1,19 +1,25 @@ use strict; use warnings; use lib 't/lib'; -use Test::More qw(no_plan); +use Test::More tests => 4; use Test::Exception; -use Devel::Dwarn; +use CafeInsertion; BEGIN { - use_ok 'Cafe'; $ENV{DBIC_TRACE} = 0; } -my $schema = Cafe->connect( 'dbi:Pg:dbname=test', 'postgres', '' ); -$schema->storage->dbh->{Warn} = 0; +my ( $dsn, $user, $pass ) + = @ENV{ map {"DBICTEST_PG_${_}"} qw/DSN USER PASS/ }; +plan skip_all => <<'EOM' unless $dsn && $user; +Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test +( NOTE: This test drops and creates some tables.') +EOM + +my $schema = CafeInsertion->connect( $dsn, $user, $pass ); $schema->storage->ensure_connected; $schema->storage->_use_insert_returning(0); +$schema->storage->dbh->{Warn} = 0; my $dir = "t/sql"; # tempdir(CLEANUP => 0); $schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir ); @@ -28,8 +34,13 @@ isa_ok( my ( $drink, $drink1 ); lives_ok { - $drink = $schema->resultset('Sumatra') - ->create( { sweetness => 4, aroma => 'earthy', flavor => 'great' } ); + $drink = $schema->resultset('Sumatra')->create( + { sweetness => 4, + fat_free => 1, + aroma => 'earthy', + flavor => 'great' + } + ); } "I can call a create on a view sumatra"; @@ -37,3 +48,15 @@ lives_ok { $drink1 = $schema->resultset('Coffee')->create( { flavor => 'aaight', } ); } "I can do it for the other view, too"; + +my $sqlt_object = $schema->{sqlt}; +is_deeply( + [ map { $_->name } $sqlt_object->get_views ], + [ qw/ + coffee + sumatra + / + ], + "SQLT view order triumphantly matches our order." +); +