Remove generated stuff
[dbsrgits/DBIx-Class-ResultSource-MultipleTableInheritance.git] / t / 04no_sequence_defined.t
CommitLineData
70955816 1use strict;
2use warnings;
3use lib 't/lib';
4use Test::More qw(no_plan);
5use Test::Exception;
4eaa25b5 6use NoSequenceSalad;
70955816 7
8BEGIN {
4eaa25b5 9 $ENV{DBIC_TRACE} = 0;
70955816 10}
32098147 11my ( $dsn, $user, $pass )
12 = @ENV{ map {"DBICTEST_PG_${_}"} qw/DSN USER PASS/ };
13
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
4eaa25b5 19my $schema = NoSequenceSalad->connect( $dsn, $user, $pass );
70955816 20$schema->storage->ensure_connected;
21$schema->storage->_use_insert_returning(0);
22
23my $dir = "t/sql"; # tempdir(CLEANUP => 0);
24$schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir );
25$schema->deploy( { add_drop_table => 1, add_drop_view => 1 } );
26
27isa_ok(
28 $schema->source('Mesclun'),
29 'DBIx::Class::ResultSource::View',
30 "My MTI class also"
31);
32
33my ( $bowl_of_salad, $bowl_of_salad1 );
34
35lives_ok {
36 $bowl_of_salad = $schema->resultset('Mesclun')
37 ->create( { acidity => 4, spiciness => '10', fresh => 0 } );
38}
39"I can call a create on a view mesclun";
40
41lives_ok {
42 $bowl_of_salad1 = $schema->resultset('Salad')->create( { fresh => 1 } );
43}
44"I can do it for the other view, too";
45
c965b761 46my $sqlt_object = $schema->{sqlt};
47is_deeply(
48 [ map { $_->name } $sqlt_object->get_views ],
49 [ qw/
50 salad
51 mesclun
52 /
53 ],
54 "SQLT view order triumphantly matches our order."
55);