+use DBIx::Class::Schema::Loader::Optional::Dependencies
+ -skip_all_without => 'test_rdbms_oracle';
+
use strict;
use warnings;
use Test::More;
use Test::Exception;
-use DBIx::Class::Optional::Dependencies;
use DBIx::Class::Schema::Loader 'make_schema_at';
use DBIx::Class::Schema::Loader::Utils qw/slurp_file split_name/;
use Try::Tiny;
return qq{ DROP SEQUENCE ${table}_${col}_seq };
};
-my $tester = dbixcsl_common_tests->new(
+dbixcsl_common_tests->new(
vendor => 'Oracle',
auto_inc_pk => 'INTEGER NOT NULL PRIMARY KEY',
auto_inc_cb => $auto_inc_cb,
},
$auto_inc_cb->('oracle_loader_test11', 'id'),
'alter trigger oracle_loader_test11_id_trg disable',
+ 'CREATE VIEW oracle_loader_test12 AS SELECT * FROM oracle_loader_test1',
+ ],
+ pre_drop_ddl => [
+ 'DROP VIEW oracle_loader_test12',
],
drop => [qw/oracle_loader_test1 oracle_loader_test9 oracle_loader_test10 oracle_loader_test11/],
- count => 10 + 31 * 2, # basic + cross-schema * 2
+ count => 12 + 31 * 2, # basic + cross-schema * 2
run => sub {
my ($monikers, $classes);
($schema, $monikers, $classes) = @_;
ok !$source11->column_info('id')->{is_auto_increment},
'Disabled autoinc trigger not loaded';
+ my $view_source = $schema->resultset($monikers->{oracle_loader_test12})->result_source;
+ isa_ok $view_source, 'DBIx::Class::ResultSource::View',
+ 'view result source';
+
+ like $view_source->view_definition,
+ qr/\A \s* select\b .* \bfrom \s+ oracle_loader_test1 \s* \z/imsx,
+ 'view definition';
+
SKIP: {
skip 'Set the DBICTEST_ORA_EXTRAUSER_DSN, _USER and _PASS environment variables to run the cross-schema relationship tests', 31 * 2
unless $ENV{DBICTEST_ORA_EXTRAUSER_DSN};
}
},
},
-);
+)->run_tests();
-if( !$dsn || !$user ) {
- $tester->skip_tests('You need to set the DBICTEST_ORA_DSN, _USER, and _PASS environment variables');
-}
-elsif (!DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_oracle')) {
- $tester->skip_tests('You need to install ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_oracle'));
-}
-else {
- $tester->run_tests();
-}
END {
if (not $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}) {