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