[Bast-commits] r4821 - in DBIx-Class-DynamicDefault/1.000/trunk/t:
. lib/TestSchema
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Thu Sep 18 18:13:18 BST 2008
Author: rafl
Date: 2008-09-18 18:13:17 +0100 (Thu, 18 Sep 2008)
New Revision: 4821
Modified:
DBIx-Class-DynamicDefault/1.000/trunk/t/basic.t
DBIx-Class-DynamicDefault/1.000/trunk/t/lib/TestSchema/Affe.pm
Log:
Test dynamic default columns depending on other columns.
Modified: DBIx-Class-DynamicDefault/1.000/trunk/t/basic.t
===================================================================
--- DBIx-Class-DynamicDefault/1.000/trunk/t/basic.t 2008-09-18 17:12:41 UTC (rev 4820)
+++ DBIx-Class-DynamicDefault/1.000/trunk/t/basic.t 2008-09-18 17:13:17 UTC (rev 4821)
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 17;
+use Test::More tests => 18;
use DBICx::TestDatabase;
BEGIN { use_ok('DBIx::Class::DynamicDefault') }
@@ -36,7 +36,7 @@
is($row->quux, -23, 'defaults don\'t get set when a value is specified explicitly on create');
-$row = $rs2->create({ moo => 0, kooh => '123', baz => 'moo' });
+$row = $rs2->create({ moo => 0, kooh => '123', baz => 'moo', bar => 'kooh' });
is($row->moo, 0, 'no default on create');
is($row->kooh, '123', 'no default on create');
@@ -47,4 +47,5 @@
is($TestSchema::Affe::moo_default_called, 1, 'callback called once to set two columns');
is($row->moo, 1, 'default on update without changes and always_update');
is($row->kooh, 'zomtec', 'on update default without always_update if another col is changed due to always_update');
-is($row->baz, 1, 'moo');
+is($row->baz, 1, 'baz set according to moo');
+is($row->bar, 1, 'bar set according to moo');
Modified: DBIx-Class-DynamicDefault/1.000/trunk/t/lib/TestSchema/Affe.pm
===================================================================
--- DBIx-Class-DynamicDefault/1.000/trunk/t/lib/TestSchema/Affe.pm 2008-09-18 17:12:41 UTC (rev 4820)
+++ DBIx-Class-DynamicDefault/1.000/trunk/t/lib/TestSchema/Affe.pm 2008-09-18 17:13:17 UTC (rev 4821)
@@ -24,6 +24,10 @@
data_type => 'integer',
dynamic_default_on_update => \'moo',
},
+ bar => {
+ data_type => 'integer',
+ dynamic_default_on_update => \'moo',
+ },
);
__PACKAGE__->set_primary_key(qw/moo/);
More information about the Bast-commits
mailing list