Massive cleanup of DateTime test dependencies, other interim
[dbsrgits/DBIx-Class.git] / t / cdbi / 26-mutator.t
1 use strict;
2 use Test::More;
3
4 BEGIN {
5   eval "use DBIx::Class::CDBICompat;";
6   plan skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"
7     if $@;
8   plan tests => 6;
9 }
10
11 use lib 't/cdbi/testlib';
12 require Film;
13
14 sub Film::accessor_name_for {
15   my ($class, $col) = @_;
16   return "sheep" if lc $col eq "numexplodingsheep";
17   return $col;
18 }
19
20 my $data = {
21   Title    => 'Bad Taste',
22   Director => 'Peter Jackson',
23   Rating   => 'R',
24 };
25
26 my $bt;
27 eval {
28   my $data = $data;
29   $data->{sheep} = 1;
30   ok $bt = Film->insert($data), "Modified accessor - with  
31 accessor";
32   isa_ok $bt, "Film";
33 };
34 is $@, '', "No errors";
35
36 eval {
37   ok $bt->sheep(2), 'Modified accessor, set';
38   ok $bt->update, 'Update';
39 };
40 is $@, '', "No errors";
41