Only load DBICTest::Schema when needed in tests
[dbsrgits/DBIx-Class-Historic.git] / t / sqlmaker / limit_dialects / custom.t
index 4a78951..15064c2 100644 (file)
@@ -2,10 +2,10 @@ use strict;
 use warnings;
 
 use Test::More;
+use Test::Warn;
 
 use lib qw(t/lib);
-use DBICTest::Schema;
-use DBIC::SqlMakerTest;
+use DBICTest ':DiffSQL';
 
 # This is legacy stuff from SQL::Absract::Limit
 # Keep it around just in case someone is using it
@@ -22,15 +22,15 @@ use DBIC::SqlMakerTest;
     );
   }
 }
-
-my $s = DBICTest::Schema->connect ('dbi:SQLite::memory:');
+my $s = DBICTest->connect_schema (DBICTest->_database);
 $s->storage->sql_maker_class ('DBICTest::SQLMaker::CustomDialect');
 
 my $rs = $s->resultset ('CD');
-is_same_sql_bind (
+
+warnings_exist { is_same_sql_bind (
   $rs->search ({}, { rows => 1, offset => 3,columns => [
       { id => 'foo.id' },
-      { 'bar.id' => 'bar.id' },
+      { 'artist.id' => 'bar.id' },
       { bleh => \ 'TO_CHAR (foo.womble, "blah")' },
     ]})->as_query,
   '(
@@ -45,6 +45,9 @@ is_same_sql_bind (
   )',
   [],
   'Rownum subsel aliasing works correctly'
-);
+ )}
+  qr/\Qthe legacy emulate_limit() mechanism inherited from SQL::Abstract::Limit has been deprecated/,
+  'deprecation warning'
+;
 
 done_testing;