Move a number of tests to xt, restructure extra lists
[dbsrgits/DBIx-Class.git] / xt / extra / diagnostics / deprecated_rs_attributes.t
CommitLineData
11343b34 1use strict;
2use warnings;
3
4use Test::More;
5use Test::Warn;
6use lib qw(t/lib);
7use DBICTest;
8
9my $schema = DBICTest->init_schema();
10
fb88ca2c 11my $cd_rs = $schema->resultset("CD")->search({ 'me.cdid' => 1 });
11343b34 12
13warnings_exist( sub {
02ddfe6e 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 );
11343b34 24}, qr/Resultset attribute 'cols' is deprecated/,
25'deprecation warning when passing cols attribute');
26
27warnings_exist( sub {
02ddfe6e 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 );
11343b34 38}, qr/Resultset attribute 'include_columns' is deprecated/,
39'deprecation warning when passing include_columns attribute');
40
41done_testing;