Add strict/warnings test, adjust all offenders (wow, that was a lot)
[dbsrgits/DBIx-Class.git] / t / cdbi / copy.t
CommitLineData
e60dc79f 1use strict;
4a233f30 2use warnings;
e60dc79f 3use Test::More;
4
e60dc79f 5INIT {
50891152 6 use lib 't/cdbi/testlib';
e60dc79f 7}
8
9{
8273e845 10 package # hide from PAUSE
e60dc79f 11 MyFilm;
12
97d61088 13 use base 'DBIC::Test::SQLite';
e60dc79f 14 use strict;
15
16 __PACKAGE__->set_table('Movies');
17 __PACKAGE__->columns(All => qw(id title));
18
19 sub create_sql {
20 return qq{
21 id INTEGER PRIMARY KEY AUTOINCREMENT,
22 title VARCHAR(255)
23 }
24 }
25}
26
27my $film = MyFilm->create({ title => "For Your Eyes Only" });
28ok $film->id;
29
30my $new_film = $film->copy;
31ok $new_film->id;
32isnt $new_film->id, $film->id, "copy() gets new primary key";
33
34$new_film = $film->copy(42);
35is $new_film->id, 42, "copy() with new id";
36
d9bd5195 37done_testing;