Merge 'column_attr' into 'trunk'
[dbsrgits/DBIx-Class.git] / t / 95sql_maker.t
index 0971d12..0f7dda8 100644 (file)
@@ -2,8 +2,9 @@ use strict;
 use warnings;
 
 use Test::More;
-use SQL::Abstract::Test import => ['is_same_sql_bind'];
 
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
 
 BEGIN {
     eval "use DBD::SQLite";
@@ -12,8 +13,6 @@ BEGIN {
         : ( tests => 3 );
 }
 
-use lib qw(t/lib);
-
 use_ok('DBICTest');
 
 my $schema = DBICTest->init_schema();
@@ -21,33 +20,38 @@ my $schema = DBICTest->init_schema();
 my $sql_maker = $schema->storage->sql_maker;
 
 
-my ($sql, @bind) = $sql_maker->insert(
-          'lottery',
-          {
-            'day' => '2008-11-16',
-            'numbers' => [13, 21, 34, 55, 89]
-          }
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/INSERT INTO lottery (day, numbers) VALUES (?, ?)/,
-    [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
-  'sql_maker passes arrayrefs in insert'
-);
-
-
-($sql, @bind) = $sql_maker->update(
-          'lottery',
-          {
-            'day' => '2008-11-16',
-            'numbers' => [13, 21, 34, 55, 89]
-          }
-);
-
-is_same_sql_bind(
-  $sql, \@bind,
-  q/UPDATE lottery SET day = ?, numbers = ?/,
-    [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
-  'sql_maker passes arrayrefs in update'
-);
+SKIP: {
+  skip "SQL::Abstract < 1.49 does not pass through arrayrefs", 2
+    if $SQL::Abstract::VERSION < 1.49;
+
+  my ($sql, @bind) = $sql_maker->insert(
+            'lottery',
+            {
+              'day' => '2008-11-16',
+              'numbers' => [13, 21, 34, 55, 89]
+            }
+  );
+
+  is_same_sql_bind(
+    $sql, \@bind,
+    q/INSERT INTO lottery (day, numbers) VALUES (?, ?)/,
+      [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
+    'sql_maker passes arrayrefs in insert'
+  );
+
+
+  ($sql, @bind) = $sql_maker->update(
+            'lottery',
+            {
+              'day' => '2008-11-16',
+              'numbers' => [13, 21, 34, 55, 89]
+            }
+  );
+
+  is_same_sql_bind(
+    $sql, \@bind,
+    q/UPDATE lottery SET day = ?, numbers = ?/,
+      [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
+    'sql_maker passes arrayrefs in update'
+  );
+}