Merge the relationship resolution rework
[dbsrgits/DBIx-Class.git] / t / cdbi / 26-mutator.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2 use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
3
4 use strict;
5 use warnings;
6
7 use Test::More;
8
9 use lib 't/cdbi/testlib';
10 require Film;
11
12 sub Film::accessor_name_for {
13   my ($class, $col) = @_;
14   return "sheep" if lc $col eq "numexplodingsheep";
15   return $col;
16 }
17
18 my $data = {
19   Title    => 'Bad Taste',
20   Director => 'Peter Jackson',
21   Rating   => 'R',
22 };
23
24 my $bt;
25 eval {
26   my $data = $data;
27   $data->{sheep} = 1;
28   ok $bt = Film->insert($data), "Modified accessor - with
29 accessor";
30   isa_ok $bt, "Film";
31 };
32 is $@, '', "No errors";
33
34 eval {
35   ok $bt->sheep(2), 'Modified accessor, set';
36   ok $bt->update, 'Update';
37 };
38 is $@, '', "No errors";
39
40 done_testing;