Reorganize CDBICompat tests - centralize prereq checks in one place
[dbsrgits/DBIx-Class.git] / t / cdbi / construct.t
CommitLineData
e60dc79f 1use strict;
2use Test::More;
3
e60dc79f 4INIT {
50891152 5 use lib 't/cdbi/testlib';
e60dc79f 6 use Film;
7}
8
146c1838 9{
10 Film->insert({
11 Title => "Breaking the Waves",
12 Director => 'Lars von Trier',
13 Rating => 'R'
14 });
e60dc79f 15
146c1838 16 my $film = Film->construct({
17 Title => "Breaking the Waves",
18 Director => 'Lars von Trier',
19 });
e60dc79f 20
146c1838 21 isa_ok $film, "Film";
22 is $film->title, "Breaking the Waves";
23 is $film->director, "Lars von Trier";
24 is $film->rating, "R",
25 "constructed objects can get missing data from the db";
26}
27
28{
29 package Foo;
30 use base qw(Film);
31 Foo->columns( TEMP => qw(temp_thing) );
32 my $film = Foo->construct({
33 temp_thing => 23
34 });
8273e845 35
146c1838 36 ::is $film->temp_thing, 23, "construct sets temp columns";
37}
d9bd5195 38
39done_testing;