Fix *stupid* silencing of exceptions introduced in 4e9fc3f3
[dbsrgits/DBIx-Class.git] / t / 746mssql.t
index 598b7a2..c7753c7 100644 (file)
@@ -1,3 +1,6 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_rdbms_mssql_odbc';
+
 use strict;
 use warnings;
 
@@ -5,20 +8,13 @@ use Test::More;
 use Test::Exception;
 use Try::Tiny;
 
-use DBIx::Class::Optional::Dependencies ();
-plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mssql_odbc')
-  unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mssql_odbc');
 
-use lib qw(t/lib);
 use DBICTest;
 
 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_ODBC_${_}" } qw/DSN USER PASS/};
 
-plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ODBC_DSN}, _USER and _PASS to run this test'
-  unless ($dsn && $user);
-
 {
-  my $srv_ver = DBICTest->connect_schema($dsn, $user, $pass)->storage->_server_info->{dbms_version};
+  my $srv_ver = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info->{dbms_version};
   ok ($srv_ver, 'Got a test server version on fresh schema: ' . ($srv_ver||'???') );
 }
 
@@ -64,7 +60,7 @@ my %opts = (
 for my $opts_name (keys %opts) {
   SKIP: {
     my $opts = $opts{$opts_name}{opts};
-    $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
+    $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
 
     try {
       $schema->storage->ensure_connected
@@ -168,7 +164,7 @@ SQL
 
       lives_ok ( sub {
         # start a new connection, make sure rebless works
-        my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
+        my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
         $schema->populate ('Owners', [
           [qw/id  name  /],
           [qw/1   wiggle/],
@@ -193,7 +189,7 @@ SQL
       lives_ok (sub {
         # start a new connection, make sure rebless works
         # test an insert with a supplied identity, followed by one without
-        my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
+        my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
         for (2, 1) {
           my $id = $_ * 20 ;
           $schema->resultset ('Owners')->create ({ id => $id, name => "troglodoogle $id" });
@@ -205,7 +201,7 @@ SQL
 
       lives_ok ( sub {
         # start a new connection, make sure rebless works
-        my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
+        my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
         $schema->populate ('BooksInLibrary', [
           [qw/source  owner title   /],
           [qw/Library 1     secrets0/],
@@ -235,7 +231,7 @@ SQL
     ) {
       for my $quoted (0, 1) {
 
-        $schema = DBICTest->connect_schema($dsn, $user, $pass, {
+        $schema = DBICTest::Schema->connect($dsn, $user, $pass, {
             limit_dialect => $dialect,
             %$opts,
             $quoted
@@ -420,7 +416,7 @@ SQL
       });
 
       # start disconnected to make sure insert works on an un-reblessed storage
-      $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
+      $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
 
       my $row;
       lives_ok {