Fix copy() assuming all columns are native
[dbsrgits/DBIx-Class.git] / t / row / copy_with_extra_selection.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 use lib qw(t/lib);
7 use DBICTest;
8
9 my $schema = DBICTest->init_schema();
10
11 my $cd = $schema->resultset('CD')->search({}, {
12   '+columns' => { avg_year => $schema->resultset('CD')->get_column('year')->func_rs('avg')->as_query },
13   order_by => 'cdid',
14 })->next;
15
16 my $ccd = $cd->copy({ cdid => 5_000_000, artist => 2 });
17
18 cmp_ok(
19   $ccd->id,
20   '!=',
21   $cd->id,
22   'IDs differ'
23 );
24
25 is(
26   $ccd->title,
27   $cd->title,
28   'Title same on copied object',
29 );
30
31 done_testing;