Add strict/warnings test, adjust all offenders (wow, that was a lot)
[dbsrgits/DBIx-Class.git] / t / cdbi / columns_dont_override_custom_accessors.t
CommitLineData
e60dc79f 1use strict;
4a233f30 2use warnings;
e60dc79f 3use Test::More;
97d61088 4use lib 't/cdbi/testlib';
e60dc79f 5
e60dc79f 6{
7 package Thing;
8
97d61088 9 use base 'DBIC::Test::SQLite';
e60dc79f 10
11 Thing->columns(TEMP => qw[foo bar]);
12 Thing->columns(All => qw[thing_id yarrow flower]);
13 sub foo { 42 }
14 sub yarrow { "hock" }
15}
16
17is_deeply( [sort Thing->columns("TEMP")],
18 [sort qw(foo bar)],
19 "TEMP columns set"
20);
21my $thing = Thing->construct(
22 { thing_id => 23, foo => "this", bar => "that" }
23);
24
25is( $thing->id, 23 );
26is( $thing->yarrow, "hock", 'custom accessor not overwritten by column' );
27is( $thing->foo, 42, 'custom routine not overwritten by temp column' );
28is( $thing->bar, "that", 'temp column accessor generated' );
d9bd5195 29
30done_testing;