Add new test for basic sanity
[dbsrgits/DBIx-Class-ResultSource-MultipleTableInheritance.git] / t / 03insert.t
CommitLineData
2c296bdb 1use strict;
2use warnings;
3use lib 't/lib';
4use Test::More qw(no_plan);
5use Test::Exception;
6use Devel::Dwarn;
7
8BEGIN {
9 use_ok 'Cafe';
ebcd7e95 10 $ENV{DBIC_TRACE} = 0;
2c296bdb 11}
32098147 12my ( $dsn, $user, $pass )
13 = @ENV{ map {"DBICTEST_PG_${_}"} qw/DSN USER PASS/ };
14plan skip_all => <<'EOM' unless $dsn && $user;
15Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test
16( NOTE: This test drops and creates some tables.')
17EOM
18
19my $schema = Cafe->connect( $dsn, $user, $pass );
ebcd7e95 20$schema->storage->dbh->{Warn} = 0;
2c296bdb 21$schema->storage->ensure_connected;
22$schema->storage->_use_insert_returning(0);
ebcd7e95 23
24my $dir = "t/sql"; # tempdir(CLEANUP => 0);
25$schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir );
26$schema->deploy( { add_drop_table => 1, add_drop_view => 1 } );
27
2c296bdb 28isa_ok(
29 $schema->source('Sumatra'),
30 'DBIx::Class::ResultSource::View',
31 "My MTI class also"
32);
33
34my ( $drink, $drink1 );
35
36lives_ok {
37 $drink = $schema->resultset('Sumatra')
38 ->create( { sweetness => 4, aroma => 'earthy', flavor => 'great' } );
39}
40"I can call a create on a view sumatra";
41
42lives_ok {
43 $drink1 = $schema->resultset('Coffee')->create( { flavor => 'aaight', } );
44}
45"I can do it for the other view, too";
e96b2eeb 46