X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fbase.t;h=c0bde464bdb0ea71547a8cd724dfe35476aab791;hb=64ae166780d0cb2b9577e506da9b9b240c146d20;hp=c8a0bba76f46764e649f8b1b44f350bd76c9bcc1;hpb=2dc8d9618fd296ecdd4484d3686832de0592e747;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/base.t b/t/storage/base.t index c8a0bba..c0bde46 100644 --- a/t/storage/base.t +++ b/t/storage/base.t @@ -1,7 +1,8 @@ use strict; -use warnings; +use warnings; use Test::More; +use Test::Warn; use lib qw(t/lib); use DBICTest; use Data::Dumper; @@ -33,8 +34,6 @@ use Data::Dumper; } } -plan tests => 17; - my $schema = DBICTest->init_schema( sqlite_use_file => 1 ); is( ref($schema->storage), 'DBIx::Class::Storage::DBI::SQLite', @@ -145,6 +144,19 @@ my $invocations = { }, ], }, + 'connect_info ([ \%attr_with_coderef ])' => { + args => [ { + dbh_maker => $coderef, + dsn => 'blah', + user => 'bleh', + on_connect_do => [qw/a b c/], + on_disconnect_do => [qw/d e f/], + } ], + dbi_connect_info => [ + $coderef + ], + warn => qr/Attribute\(s\) 'dsn', 'user' in connect_info were ignored/, + }, }; for my $type (keys %$invocations) { @@ -154,11 +166,14 @@ for my $type (keys %$invocations) { local $Data::Dumper::Sortkeys = 1; my $arg_dump = Dumper ($invocations->{$type}{args}); - $storage->connect_info ($invocations->{$type}{args}); + warnings_exist ( + sub { $storage->connect_info ($invocations->{$type}{args}) }, + $invocations->{$type}{warn} || (), + 'Warned about ignored attributes', + ); is ($arg_dump, Dumper ($invocations->{$type}{args}), "$type didn't modify passed arguments"); - is_deeply ($storage->_dbi_connect_info, $invocations->{$type}{dbi_connect_info}, "$type produced correct _dbi_connect_info"); ok ( (not $storage->auto_savepoint and not $storage->unsafe), "$type correctly ignored extra hashref"); @@ -169,4 +184,6 @@ for my $type (keys %$invocations) { ); } +done_testing; + 1;