Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (26 sloc) 840 Bytes
BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
use strict;
use warnings;
use Test::More;
use lib 't/cdbi/testlib';
{
package Thing;
use base 'DBIC::Test::SQLite';
Thing->columns(TEMP => qw[foo bar]);
Thing->columns(All => qw[thing_id yarrow flower]);
sub foo { 42 }
sub yarrow { "hock" }
}
is_deeply( [sort Thing->columns("TEMP")],
[sort qw(foo bar)],
"TEMP columns set"
);
my $thing = Thing->construct(
{ thing_id => 23, foo => "this", bar => "that" }
);
is( $thing->id, 23 );
is( $thing->yarrow, "hock", 'custom accessor not overwritten by column' );
is( $thing->foo, 42, 'custom routine not overwritten by temp column' );
is( $thing->bar, "that", 'temp column accessor generated' );
done_testing;