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