Commit | Line | Data |
83eef562 |
1 | use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat'; |
2 | |
d2cee1fa |
3 | use strict; |
4a233f30 |
4 | use warnings; |
83eef562 |
5 | |
d2cee1fa |
6 | use Test::More; |
7 | |
50891152 |
8 | use lib 't/cdbi/testlib'; |
d2cee1fa |
9 | require Film; |
10 | |
11 | sub Film::accessor_name_for { |
6a3bf251 |
12 | my ($class, $col) = @_; |
13 | return "sheep" if lc $col eq "numexplodingsheep"; |
14 | return $col; |
d2cee1fa |
15 | } |
16 | |
17 | my $data = { |
6a3bf251 |
18 | Title => 'Bad Taste', |
19 | Director => 'Peter Jackson', |
20 | Rating => 'R', |
d2cee1fa |
21 | }; |
22 | |
23 | my $bt; |
24 | eval { |
6a3bf251 |
25 | my $data = $data; |
26 | $data->{sheep} = 1; |
8273e845 |
27 | ok $bt = Film->insert($data), "Modified accessor - with |
d2cee1fa |
28 | accessor"; |
6a3bf251 |
29 | isa_ok $bt, "Film"; |
d2cee1fa |
30 | }; |
31 | is $@, '', "No errors"; |
32 | |
33 | eval { |
6a3bf251 |
34 | ok $bt->sheep(2), 'Modified accessor, set'; |
35 | ok $bt->update, 'Update'; |
d2cee1fa |
36 | }; |
37 | is $@, '', "No errors"; |
38 | |
d9bd5195 |
39 | done_testing; |