Commit | Line | Data |
e60dc79f |
1 | use strict; |
4a233f30 |
2 | use warnings; |
e60dc79f |
3 | use Test::More; |
4 | |
a40329c4 |
5 | use lib 't/cdbi/testlib'; |
6 | use Film; |
e60dc79f |
7 | |
146c1838 |
8 | { |
9 | Film->insert({ |
10 | Title => "Breaking the Waves", |
11 | Director => 'Lars von Trier', |
12 | Rating => 'R' |
13 | }); |
e60dc79f |
14 | |
146c1838 |
15 | my $film = Film->construct({ |
16 | Title => "Breaking the Waves", |
17 | Director => 'Lars von Trier', |
18 | }); |
e60dc79f |
19 | |
146c1838 |
20 | isa_ok $film, "Film"; |
21 | is $film->title, "Breaking the Waves"; |
22 | is $film->director, "Lars von Trier"; |
23 | is $film->rating, "R", |
24 | "constructed objects can get missing data from the db"; |
25 | } |
26 | |
27 | { |
28 | package Foo; |
29 | use base qw(Film); |
30 | Foo->columns( TEMP => qw(temp_thing) ); |
31 | my $film = Foo->construct({ |
32 | temp_thing => 23 |
33 | }); |
8273e845 |
34 | |
146c1838 |
35 | ::is $film->temp_thing, 23, "construct sets temp columns"; |
36 | } |
d9bd5195 |
37 | |
38 | done_testing; |