[Bast-commits] r8180 - in DBIx-Class-DynamicDefault/1.000/trunk/t:
. lib/TestSchema
wreis at dev.catalyst.perl.org
wreis at dev.catalyst.perl.org
Tue Dec 29 16:56:44 GMT 2009
Author: wreis
Date: 2009-12-29 16:56:41 +0000 (Tue, 29 Dec 2009)
New Revision: 8180
Added:
DBIx-Class-DynamicDefault/1.000/trunk/t/lib/TestSchema/Extended.pm
Modified:
DBIx-Class-DynamicDefault/1.000/trunk/t/basic.t
Log:
failing tests for use of add_column
Modified: DBIx-Class-DynamicDefault/1.000/trunk/t/basic.t
===================================================================
--- DBIx-Class-DynamicDefault/1.000/trunk/t/basic.t 2009-12-29 14:38:40 UTC (rev 8179)
+++ DBIx-Class-DynamicDefault/1.000/trunk/t/basic.t 2009-12-29 16:56:41 UTC (rev 8180)
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 26;
+use Test::More tests => 28;
use DBICx::TestDatabase;
BEGIN { use_ok('DBIx::Class::DynamicDefault') }
@@ -12,6 +12,7 @@
my $schema = DBICTest->init_schema;
my $rs = $schema->resultset('Table');
my $rs2 = $schema->resultset('Affe');
+my $rs3 = $schema->resultset('Extended');
my $row = $rs->create({ fred => 'affe' });
@@ -64,3 +65,7 @@
is($row->moo, 3);
is($row->baz, 5);
is($row->bar, 3);
+
+$row = $rs3->create({ fred => 'affe2' });
+ok($row->quux, 'default on create with methodname for quux');
+ok($row->extra_field, 'default on create with methodname for extra_field');
Added: DBIx-Class-DynamicDefault/1.000/trunk/t/lib/TestSchema/Extended.pm
===================================================================
--- DBIx-Class-DynamicDefault/1.000/trunk/t/lib/TestSchema/Extended.pm (rev 0)
+++ DBIx-Class-DynamicDefault/1.000/trunk/t/lib/TestSchema/Extended.pm 2009-12-29 16:56:41 UTC (rev 8180)
@@ -0,0 +1,15 @@
+package TestSchema::Extended;
+
+use strict;
+use warnings;
+use parent 'TestSchema::Table';
+
+__PACKAGE__->table('fubar_extended');
+__PACKAGE__->add_column('extra_field' => {
+ data_type => 'integer',
+ dynamic_default_on_create => 'extra_field_default'
+});
+
+sub extra_field_default { return shift->quux + 1 }
+
+1;
More information about the Bast-commits
mailing list