tweaked search_rs to not be destructive to passed
[dbsrgits/DBIx-Class.git] / t / 19quotes.t
index 18588c8..ad44bcb 100644 (file)
@@ -1,4 +1,6 @@
 use strict;
+use warnings;
+
 use Test::More;
 use IO::File;
 
@@ -12,8 +14,7 @@ BEGIN {
 use lib qw(t/lib);
 
 use_ok('DBICTest');
-
-use_ok('DBICTest::HelperRels');
+DBICTest->init_schema();
 
 DBICTest->schema->storage->sql_maker->quote_char("'");
 DBICTest->schema->storage->sql_maker->name_sep('.');
@@ -27,17 +28,17 @@ cmp_ok( $rs->count, '==', 1, "join with fields quoted");
 $rs = DBICTest::CD->search({},
             { 'order_by' => 'year DESC'});
 {
-       my $warnings;
+       my $warnings = '';
        local $SIG{__WARN__} = sub { $warnings .= $_[0] };
        my $first = eval{ $rs->first() };
-       ok( $warnings =~ /ORDER BY terms/, "Problem with ORDER BY quotes" );
+       like( $warnings, qr/ORDER BY terms/, "Problem with ORDER BY quotes" );
 }
 
 my $order = 'year DESC';
 $rs = DBICTest::CD->search({},
             { 'order_by' => \$order });
 {
-       my $warnings;
+       my $warnings = '';
        local $SIG{__WARN__} = sub { $warnings .= $_[0] };
        my $first = $rs->first();
        ok( $warnings !~ /ORDER BY terms/,
@@ -52,6 +53,13 @@ $rs = DBICTest::CD->search(
            { join => 'artist' });
 cmp_ok($rs->count,'==', 1,"join quoted with brackets.");
 
+my %data = (
+       name => 'Bill',
+       order => '12'
+);
 
+DBICTest->schema->storage->sql_maker->quote_char('`');
+DBICTest->schema->storage->sql_maker->name_sep('.');
 
+cmp_ok(DBICTest->schema->storage->sql_maker->update('group', \%data), 'eq', 'UPDATE `group` SET `name` = ?, `order` = ?', "quoted table names for UPDATE");