[Bast-commits] r6407 - DBIx-Class/0.08/trunk/t

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Sun May 24 23:53:13 GMT 2009


Author: caelum
Date: 2009-05-24 23:53:12 +0000 (Sun, 24 May 2009)
New Revision: 6407

Modified:
   DBIx-Class/0.08/trunk/t/746mssql.t
Log:
added test to make sure only one connection to ODBC/MSSQL is made

Modified: DBIx-Class/0.08/trunk/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/trunk/t/746mssql.t	2009-05-24 23:49:17 UTC (rev 6406)
+++ DBIx-Class/0.08/trunk/t/746mssql.t	2009-05-24 23:53:12 UTC (rev 6407)
@@ -10,12 +10,21 @@
 plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ODBC_DSN}, _USER and _PASS to run this test'
   unless ($dsn && $user);
 
-plan tests => 12;
+plan tests => 13;
 
 my $schema = DBICTest::Schema->connect($dsn, $user, $pass, {AutoCommit => 1});
 
-$schema->storage->ensure_connected;
+{
+  no warnings 'redefine';
+  my $connect_count = 0;
+  my $orig_connect = \&DBI::connect;
+  local *DBI::connect = sub { $connect_count++; goto &$orig_connect };
 
+  $schema->storage->ensure_connected;
+
+  is( $connect_count, 1, 'only one connection made');
+}
+
 isa_ok( $schema->storage, 'DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server' );
 
 $schema->storage->dbh_do (sub {




More information about the Bast-commits mailing list