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