Expand annotations to cover all generated methods
[dbsrgits/DBIx-Class.git] / t / cdbi / copy.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
83eef562 2use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
3
e60dc79f 4use strict;
4a233f30 5use warnings;
83eef562 6
e60dc79f 7use Test::More;
8
a40329c4 9use lib 't/cdbi/testlib';
e60dc79f 10
11{
8273e845 12 package # hide from PAUSE
e60dc79f 13 MyFilm;
14
97d61088 15 use base 'DBIC::Test::SQLite';
e60dc79f 16 use strict;
17
18 __PACKAGE__->set_table('Movies');
19 __PACKAGE__->columns(All => qw(id title));
20
21 sub create_sql {
22 return qq{
23 id INTEGER PRIMARY KEY AUTOINCREMENT,
24 title VARCHAR(255)
25 }
26 }
27}
28
29my $film = MyFilm->create({ title => "For Your Eyes Only" });
30ok $film->id;
31
32my $new_film = $film->copy;
33ok $new_film->id;
34isnt $new_film->id, $film->id, "copy() gets new primary key";
35
36$new_film = $film->copy(42);
37is $new_film->id, 42, "copy() with new id";
38
d9bd5195 39done_testing;