X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F86sqlt.t;h=486b5ed4e9b4996ae3663e9f68d2a6de868544e5;hb=63ee8b7896e02ee888eb26251fc28311721832c5;hp=89783d361cb2494ea7b18b848baa002cdd3f8f7d;hpb=65d351219882184861384aedac6f251b6797d0d7;p=dbsrgits%2FDBIx-Class.git diff --git a/t/86sqlt.t b/t/86sqlt.t index 89783d3..486b5ed 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -1,18 +1,15 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } +use DBIx::Class::Optional::Dependencies -skip_all_without => 'deploy'; + use strict; use warnings; use Test::More; -use lib qw(t/lib); -use DBICTest; - +use Test::Warn; use Scalar::Util 'blessed'; -BEGIN { - 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 DBICTest; my $custom_deployment_statements_called = 0; @@ -22,11 +19,10 @@ sub DBICTest::Schema::deployment_statements { return $self->next::method(@_); } - # Check deployment statements ctx sensitivity { - my $schema = DBICTest->init_schema (no_deploy => 1); - my $not_first_table_creation_re = qr/CREATE TABLE fourkeys_to_twokeys/; + my $schema = DBICTest->init_schema (no_deploy => 1, quote_names => 1); + my $not_first_table_creation_re = qr/CREATE TABLE "fourkeys_to_twokeys"/; my $statements = $schema->deployment_statements; like ( @@ -118,19 +114,15 @@ my $schema = DBICTest->init_schema (no_deploy => 1); my $translator = SQL::Translator->new( parser_args => { - 'DBIx::Schema' => $schema, + dbic_schema => $schema, }, producer_args => {}, ); -{ - my $warn = ''; - local $SIG{__WARN__} = sub { $warn = shift }; - +warnings_exist { my $relinfo = $schema->source('Artist')->relationship_info ('cds'); local $relinfo->{attrs}{on_delete} = 'restrict'; - $translator->parser('SQL::Translator::Parser::DBIx::Class'); $translator->producer('SQLite'); @@ -139,13 +131,9 @@ my $translator = SQL::Translator->new( ok($output, "SQLT produced someoutput") or diag($translator->error); - - like ( - $warn, - qr/SQLT attribute .+? was supplied for relationship .+? which does not appear to be a foreign constraint/, - 'Warn about dubious on_delete/on_update attributes', - ); -} +} [ + (qr/SQLT attribute .+? was supplied for relationship .+? which does not appear to be a foreign constraint/) x 2 +], 'Warn about dubious on_delete/on_update attributes'; # Note that the constraints listed here are the only ones that are tested -- if # more exist in the Schema than are listed here and all listed constraints are