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