Retire DBIC/SqlMakerTest.pm now that SQLA::Test provides the same function
[dbsrgits/DBIx-Class.git] / t / sqlmaker / core.t
index 2cf88ba..1c2a1c3 100644 (file)
@@ -5,9 +5,7 @@ use Test::More;
 use Test::Exception;
 
 use lib qw(t/lib);
-use DBIC::SqlMakerTest;
-
-use_ok('DBICTest');
+use DBICTest ':DiffSQL';
 
 my $schema = DBICTest->init_schema(no_deploy => 1);
 
@@ -69,6 +67,36 @@ my $sql_maker = $schema->storage->sql_maker;
   );
 }
 
+# Tests base class for => \'FOO' actually generates proper query. for =>
+# 'READ'|'SHARE' is tested in db-specific subclasses
+# we have to instantiate base because SQLMaker::SQLite disables _lock_select
+{
+  require DBIx::Class::SQLMaker;
+  my $sa = DBIx::Class::SQLMaker->new;
+  {
+    my ($sql, @bind) = $sa->select('foo', '*', {}, { for => 'update' } );
+    is_same_sql_bind(
+      $sql,
+      \@bind,
+      'SELECT * FROM foo FOR UPDATE',
+      [],
+    );
+  }
+
+  {
+    my ($sql, @bind) = $sa->select('bar', '*', {}, { for => \'baz' } );
+    is_same_sql_bind(
+      $sql,
+      \@bind,
+      'SELECT * FROM bar FOR baz',
+      [],
+    );
+  }
+
+}
+
+
+
 # Make sure the carp/croak override in SQLA works (via SQLMaker)
 my $file = quotemeta (__FILE__);
 throws_ok (sub {