Add strict/warnings test, adjust all offenders (wow, that was a lot)
[dbsrgits/DBIx-Class.git] / t / cdbi / construct.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 INIT {
6     use lib 't/cdbi/testlib';
7     use Film;
8 }
9
10 {
11     Film->insert({
12         Title     => "Breaking the Waves",
13         Director  => 'Lars von Trier',
14         Rating    => 'R'
15     });
16
17     my $film = Film->construct({
18         Title     => "Breaking the Waves",
19         Director  => 'Lars von Trier',
20     });
21
22     isa_ok $film, "Film";
23     is $film->title,    "Breaking the Waves";
24     is $film->director, "Lars von Trier";
25     is $film->rating,   "R",
26         "constructed objects can get missing data from the db";
27 }
28
29 {
30     package Foo;
31     use base qw(Film);
32     Foo->columns( TEMP => qw(temp_thing) );
33     my $film = Foo->construct({
34         temp_thing  => 23
35     });
36
37     ::is $film->temp_thing, 23, "construct sets temp columns";
38 }
39
40 done_testing;