Move a number of tests to xt, restructure extra lists
[dbsrgits/DBIx-Class.git] / xt / extra / diagnostics / deprecated_rs_attributes.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Warn;
6 use lib qw(t/lib);
7 use DBICTest;
8
9 my $schema = DBICTest->init_schema();
10
11 my $cd_rs = $schema->resultset("CD")->search({ 'me.cdid' => 1 });
12
13 warnings_exist( sub {
14   my $cd = $cd_rs->search( undef, {
15     cols => [ { name => 'artist.name' } ],
16     join => 'artist',
17   })->next;
18
19   is_deeply (
20     { $cd->get_inflated_columns },
21     { name => 'Caterwauler McCrae' },
22     'cols attribute still works',
23   );
24 }, qr/Resultset attribute 'cols' is deprecated/,
25 'deprecation warning when passing cols attribute');
26
27 warnings_exist( sub {
28   my $cd = $cd_rs->search_rs( undef, {
29     include_columns => [ { name => 'artist.name' } ],
30     join => 'artist',
31   })->next;
32
33   is (
34     $cd->get_column('name'),
35     'Caterwauler McCrae',
36     'include_columns attribute still works',
37   );
38 }, qr/Resultset attribute 'include_columns' is deprecated/,
39 'deprecation warning when passing include_columns attribute');
40
41 done_testing;