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; |
97d61088 |
7 | use lib 't/cdbi/testlib'; |
e60dc79f |
8 | |
e60dc79f |
9 | { |
10 | package Thing; |
11 | |
97d61088 |
12 | use base 'DBIC::Test::SQLite'; |
e60dc79f |
13 | |
14 | Thing->columns(TEMP => qw[foo bar]); |
15 | Thing->columns(All => qw[thing_id yarrow flower]); |
16 | sub foo { 42 } |
17 | sub yarrow { "hock" } |
18 | } |
19 | |
20 | is_deeply( [sort Thing->columns("TEMP")], |
21 | [sort qw(foo bar)], |
22 | "TEMP columns set" |
23 | ); |
24 | my $thing = Thing->construct( |
25 | { thing_id => 23, foo => "this", bar => "that" } |
26 | ); |
27 | |
28 | is( $thing->id, 23 ); |
29 | is( $thing->yarrow, "hock", 'custom accessor not overwritten by column' ); |
30 | is( $thing->foo, 42, 'custom routine not overwritten by temp column' ); |
31 | is( $thing->bar, "that", 'temp column accessor generated' ); |
d9bd5195 |
32 | |
33 | done_testing; |