Commit | Line | Data |
908c46a2 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
8 | my $row = DBICTest::Schema::CD->new({ title => 'foo' }); |
9 | |
10 | my @values = qw( foo bar baz ); |
11 | for my $i ( 0 .. $#values ) { |
12 | { |
13 | local $TODO = 'This probably needs to always return 1, on virgin objects... same with get_dirty_columns' |
14 | unless $i; |
15 | |
16 | ok ( $row->is_column_changed('title'), 'uninserted row properly reports "eternally changed" value' ); |
17 | is_deeply ( |
18 | { $row->get_dirty_columns }, |
19 | { title => $values[$i-1] }, |
20 | 'uninserted row properly reports "eternally changed" dirty_columns()' |
21 | ); |
22 | } |
23 | |
24 | $row->title( $values[$i] ); |
25 | |
26 | ok( $row->is_column_changed('title'), 'uninserted row properly reports changed value' ); |
27 | is( $row->title, $values[$i] , 'Expected value on sourceless row' ); |
28 | for my $meth (qw( get_columns get_inflated_columns get_dirty_columns )) { |
29 | is_deeply( |
30 | { $row->$meth }, |
31 | { title => $values[$i] }, |
32 | "Expected '$meth' rv", |
33 | ) |
34 | } |
35 | } |
36 | |
37 | done_testing; |