From: Peter Rabbitson Date: Wed, 10 Jun 2009 16:08:25 +0000 (+0000) Subject: Test for type-aware update X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9ae809a5db4996c266b45724abfd4c5a0f15d39;p=dbsrgits%2FDBIx-Class-Historic.git Test for type-aware update --- diff --git a/t/update/type_aware.t b/t/update/type_aware.t new file mode 100644 index 0000000..05f86c3 --- /dev/null +++ b/t/update/type_aware.t @@ -0,0 +1,27 @@ +use strict; +use warnings; + +use Test::More; +use lib qw(t/lib); +use DBICTest; + +my $schema = DBICTest->init_schema(); + +plan tests => 4; + +my $artist = $schema->resultset ('Artist')->first; +ok (!$artist->get_dirty_columns, 'Artist is clean' ); + +$artist->rank (13); +ok (!$artist->get_dirty_columns, 'Artist is clean after num value update' ); +$artist->discard_changes; + +$artist->rank ('13.00'); +ok (!$artist->get_dirty_columns, 'Artist is clean after string value update' ); +$artist->discard_changes; + +# override column info +$artist->result_source->column_info ('rank')->{is_numeric} = 0; +$artist->rank ('13.00'); +ok ($artist->get_dirty_columns, 'Artist is updated after is_numeric override' ); +$artist->discard_changes;