1use strict;
2use Test::More;
3use lib 't/cdbi/testlib';
4
5BEGIN {
6  eval "use DBIx::Class::CDBICompat;";
7  plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
8          : (tests=> 5);
9}
10
11{
12    package Thing;
13
14    use base 'DBIC::Test::SQLite';
15
16    Thing->columns(TEMP => qw[foo bar]);
17    Thing->columns(All  => qw[thing_id yarrow flower]);
18    sub foo { 42 }
19    sub yarrow { "hock" }
20}
21
22is_deeply( [sort Thing->columns("TEMP")],
23           [sort qw(foo bar)],
24           "TEMP columns set"
25);
26my $thing = Thing->construct(
27    { thing_id => 23, foo => "this", bar => "that" }
28);
29
30is( $thing->id, 23 );
31is( $thing->yarrow, "hock", 'custom accessor not overwritten by column' );
32is( $thing->foo, 42, 'custom routine not overwritten by temp column' );
33is( $thing->bar, "that", 'temp column accessor generated' );
34