Add strict/warnings test, adjust all offenders (wow, that was a lot)
[dbsrgits/DBIx-Class.git] / t / cdbi / construct.t
CommitLineData
e60dc79f 1use strict;
4a233f30 2use warnings;
e60dc79f 3use Test::More;
4
e60dc79f 5INIT {
50891152 6 use lib 't/cdbi/testlib';
e60dc79f 7 use Film;
8}
9
146c1838 10{
11 Film->insert({
12 Title => "Breaking the Waves",
13 Director => 'Lars von Trier',
14 Rating => 'R'
15 });
e60dc79f 16
146c1838 17 my $film = Film->construct({
18 Title => "Breaking the Waves",
19 Director => 'Lars von Trier',
20 });
e60dc79f 21
146c1838 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 });
8273e845 36
146c1838 37 ::is $film->temp_thing, 23, "construct sets temp columns";
38}
d9bd5195 39
40done_testing;