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