Commit | Line | Data |
d2cee1fa |
1 | use strict; |
2 | use Test::More; |
3 | |
4 | BEGIN { |
40f05175 |
5 | eval "use DBIx::Class::CDBICompat;"; |
6 | plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@" |
7 | if $@; |
8 | } |
9 | |
10 | BEGIN { |
6a3bf251 |
11 | eval "use DBD::SQLite"; |
12 | plan $@ |
13 | ? (skip_all => 'needs DBD::SQLite for testing') |
14 | : (tests => 6); |
d2cee1fa |
15 | } |
16 | |
50891152 |
17 | use lib 't/cdbi/testlib'; |
d2cee1fa |
18 | require Film; |
19 | |
20 | sub Film::accessor_name_for { |
6a3bf251 |
21 | my ($class, $col) = @_; |
22 | return "sheep" if lc $col eq "numexplodingsheep"; |
23 | return $col; |
d2cee1fa |
24 | } |
25 | |
26 | my $data = { |
6a3bf251 |
27 | Title => 'Bad Taste', |
28 | Director => 'Peter Jackson', |
29 | Rating => 'R', |
d2cee1fa |
30 | }; |
31 | |
32 | my $bt; |
33 | eval { |
6a3bf251 |
34 | my $data = $data; |
35 | $data->{sheep} = 1; |
36 | ok $bt = Film->insert($data), "Modified accessor - with |
d2cee1fa |
37 | accessor"; |
6a3bf251 |
38 | isa_ok $bt, "Film"; |
d2cee1fa |
39 | }; |
40 | is $@, '', "No errors"; |
41 | |
42 | eval { |
6a3bf251 |
43 | ok $bt->sheep(2), 'Modified accessor, set'; |
44 | ok $bt->update, 'Update'; |
d2cee1fa |
45 | }; |
46 | is $@, '', "No errors"; |
47 | |