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