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