Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / t / row / copy_with_extra_selection.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8
9 use DBICTest;
10
11 my $schema = DBICTest->init_schema();
12
13 my $cd = $schema->resultset('CD')->search({}, {
14   '+columns' => { avg_year => $schema->resultset('CD')->get_column('year')->func_rs('avg')->as_query },
15   order_by => 'cdid',
16 })->next;
17
18 my $ccd = $cd->copy({ cdid => 5_000_000, artist => 2 });
19
20 cmp_ok(
21   $ccd->id,
22   '!=',
23   $cd->id,
24   'IDs differ'
25 );
26
27 is(
28   $ccd->title,
29   $cd->title,
30   'Title same on copied object',
31 );
32
33 done_testing;