minor fix to last committed test
[dbsrgits/DBIx-Class.git] / t / storage / base.t
index 138465d..c0bde46 100644 (file)
@@ -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 => 21;
-
 my $schema = DBICTest->init_schema( sqlite_use_file => 1 );
 
 is( ref($schema->storage), 'DBIx::Class::Storage::DBI::SQLite',
@@ -148,12 +147,15 @@ 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/,
   },
 };
 
@@ -164,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");
 
@@ -179,4 +184,6 @@ for my $type (keys %$invocations) {
   );
 }
 
+done_testing;
+
 1;