f1fd693846774f9ca8120878dfc3cfc128dcdbd4
[dbsrgits/DBIx-Class.git] / t / sqlmaker / nest_deprec.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Warn;
6
7 local $TODO = 'Temporarily todo-ed for dq2eb';
8
9 use lib qw(t/lib);
10 use DBICTest;
11 use DBIC::SqlMakerTest;
12
13 my $schema = DBICTest->init_schema();
14
15 my $sql_maker = $schema->storage->sql_maker;
16
17 # a loop so that the callsite line does not change
18 for my $expect_warn (1, 0) {
19   warnings_like (
20     sub {
21       my ($sql, @bind) = $sql_maker->select ('foo', undef, { -nest => \ 'bar' } );
22       is_same_sql_bind (
23         $sql, \@bind,
24         'SELECT * FROM foo WHERE ( bar )', [],
25         '-nest still works'
26       );
27     },
28     ($expect_warn ? qr/\Q-nest in search conditions is deprecated/ : []),
29     'Only one deprecation warning'
30   );
31 }
32
33 done_testing;