use Test::More;
use Test::Exception;
+use Test::Warn;
use lib qw(t/lib);
use ViewDeps;
use ViewDepsBad;
BEGIN {
- use_ok('DBIx::Class::ResultSource::View');
+ require DBIx::Class;
+ plan skip_all => 'Test needs ' .
+ DBIx::Class::Optional::Dependencies->req_missing_for('deploy')
+ unless DBIx::Class::Optional::Dependencies->req_ok_for('deploy');
}
+use_ok('DBIx::Class::ResultSource::View');
+
#################### SANITY
my $view = DBIx::Class::ResultSource::View->new;
#################### DEPLOY2
-$schema2->deploy( { add_drop_table => 1 } );
+warnings_exist { $schema2->deploy( { add_drop_table => 1 } ); }
+[qr/no such table: main.aba_name_artists/],
+ "Deploying the bad schema produces a warning: aba_name_artists was not created.";
#################### DOES ORDERING WORK 2?
sub {
$schema2->resultset('AbaNameArtistsAnd2010CDsWithManyTracks')->next;
},
- "Query on AbaNameArtistsAnd2010CDsWithManyTracks fails, because of incorrect deploy_depends_on in AbaNameArtists"
+ "Query on AbaNameArtistsAnd2010CDsWithManyTracks dies, because of incorrect deploy_depends_on in AbaNameArtists"
);
+throws_ok {
+ $schema2->resultset('AbaNameArtistsAnd2010CDsWithManyTracks')->next;
+}
+qr/no such table: aba_name_artists_and_2010_cds_with_many_tracks/,
+ "Query on AbaNameArtistsAnd2010CDsWithManyTracks throws, because the table does not exist";
+
done_testing;