Must set schema->storage->_use_insert_returning to 0 manually.
BEGIN {
use_ok 'MTITest';
- #$ENV{DBIC_TRACE} = 1;
+ $ENV{DBIC_TRACE} = 1;
}
dies_ok { MTITest->source('Foo')->view_definition }
"Can't generate view def without connected schema";
-#my $schema = MTITest->connect('dbi:SQLite::memory:');
-
my $schema = MTITest->connect( 'dbi:Pg:dbname=mti', 'postgres', '' );
my $dir = "t/sql"; # tempdir(CLEANUP => 0);
+++ /dev/null
-use strict;
-use warnings;
-use lib 't/lib';
-use Test::More qw(no_plan);
-use Test::Exception;
-use Devel::Dwarn;
-
-BEGIN {
- use_ok 'Cafe';
- #$ENV{DBIC_TRACE} = 1;
-}
-
-my $schema = Cafe->connect( 'dbi:Pg:dbname=cafe', 'postgres', '' );
-
-isa_ok($schema->source('Sumatra'), 'DBIx::Class::ResultSource::View', "My MTI class also");
-
-#my $dir = "t/sql"; # tempdir(CLEANUP => 0);
-#$schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir );
-
-#$schema->deploy( { add_drop_table => 1, add_drop_view => 1 } );
-
-my $drink = $schema->resultset('Sumatra')
- ->create( { sweetness => 4, aroma => 'earthy', flavor => 'great' } );
-
-#my $cup = $schema->resultset('Coffee');
-
-##my $drink = $schema->resultset('Sumatra')->new_result({sweetness => 6, aroma => 'chocolate'});
-#ok($drink, "made new drink OK");
-#$drink->insert;
-
-#$drink->insert_or_update;
--- /dev/null
+use strict;
+use warnings;
+use lib 't/lib';
+use Test::More qw(no_plan);
+use Test::Exception;
+use Devel::Dwarn;
+
+BEGIN {
+ use_ok 'Cafe';
+ $ENV{DBIC_TRACE} = 1;
+}
+
+my $schema = Cafe->connect( 'dbi:Pg:dbname=cafe', 'postgres', '' );
+$schema->storage->ensure_connected;
+$schema->storage->_use_insert_returning(0);
+isa_ok(
+ $schema->source('Sumatra'),
+ 'DBIx::Class::ResultSource::View',
+ "My MTI class also"
+);
+
+my ( $drink, $drink1 );
+
+lives_ok {
+ $drink = $schema->resultset('Sumatra')
+ ->create( { sweetness => 4, aroma => 'earthy', flavor => 'great' } );
+}
+"I can call a create on a view sumatra";
+
+lives_ok {
+ $drink1 = $schema->resultset('Coffee')->create( { flavor => 'aaight', } );
+}
+"I can do it for the other view, too";