X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F86sqlt.t;h=87b90a59998ce1098817625e57b22c6df11b90af;hb=c2abfbbebf5952ef4e9f45750903f5129fdbabae;hp=57268708509ef34144823f611d2426a8cb4dd297;hpb=8273e845426f0187b4ad6c4a1b42286fa09a648f;p=dbsrgits%2FDBIx-Class.git diff --git a/t/86sqlt.t b/t/86sqlt.t index 5726870..87b90a5 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More; +use Test::Warn; use lib qw(t/lib); use DBICTest; @@ -26,7 +27,7 @@ sub DBICTest::Schema::deployment_statements { # 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 $not_first_table_creation_re = qr/CREATE TABLE "fourkeys_to_twokeys"/; my $statements = $schema->deployment_statements; like ( @@ -88,6 +89,7 @@ my $schema = DBICTest->init_schema (no_deploy => 1); { my $deploy_hook_called = 0; $custom_deployment_statements_called = 0; + my $sqlt_type = $schema->storage->sqlt_type; # replace the sqlt calback with a custom version ading an index $schema->source('Track')->sqlt_deploy_callback(sub { @@ -97,11 +99,11 @@ my $schema = DBICTest->init_schema (no_deploy => 1); is ( $sqlt_table->schema->translator->producer_type, - join ('::', 'SQL::Translator::Producer', $schema->storage->sqlt_type), + join ('::', 'SQL::Translator::Producer', $sqlt_type), 'Production type passed to translator object', ); - if ($schema->storage->sqlt_type eq 'SQLite' ) { + if ($sqlt_type eq 'SQLite' ) { $sqlt_table->add_index( name => 'track_title', fields => ['title'] ) or die $sqlt_table->error; } @@ -117,19 +119,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'); @@ -138,13 +136,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