Manual workaround for Pg and DBICs default insert_returning behavior.
[dbsrgits/DBIx-Class-ResultSource-MultipleTableInheritance.git] / t / 03insert.t
1 use strict;
2 use warnings;
3 use lib 't/lib';
4 use Test::More qw(no_plan);
5 use Test::Exception;
6 use Devel::Dwarn;
7
8 BEGIN {
9     use_ok 'Cafe';
10     $ENV{DBIC_TRACE} = 1;
11 }
12
13 my $schema = Cafe->connect( 'dbi:Pg:dbname=cafe', 'postgres', '' );
14 $schema->storage->ensure_connected;
15 $schema->storage->_use_insert_returning(0);
16 isa_ok(
17     $schema->source('Sumatra'),
18     'DBIx::Class::ResultSource::View',
19     "My MTI class also"
20 );
21
22 my ( $drink, $drink1 );
23
24 lives_ok {
25     $drink = $schema->resultset('Sumatra')
26         ->create( { sweetness => 4, aroma => 'earthy', flavor => 'great' } );
27 }
28 "I can call a create on a view sumatra";
29
30 lives_ok {
31     $drink1 = $schema->resultset('Coffee')->create( { flavor => 'aaight', } );
32 }
33 "I can do it for the other view, too";