Make fieldType a required parameter of a Definition Asset property.

This commit is contained in:
Colin Kuskie 2009-12-17 13:00:54 -08:00
parent f997981d73
commit 3b31069b1c
2 changed files with 41 additions and 12 deletions

View file

@ -39,11 +39,13 @@ The following methods are added.
extends 'WebGUI::Definition::Meta::Property';
has 'tableName' => (
is => 'ro',
is => 'ro',
required => 1,
);
has 'fieldType' => (
is => 'ro',
is => 'ro',
required => 1,
);
has 'noFormPost' => (

View file

@ -14,7 +14,7 @@ no warnings qw(uninitialized);
use Test::More 'no_plan'; #tests => 1;
use Test::Deep;
#use Test::Exception;
use Test::Exception;
my $called_getProperties;
{
@ -57,13 +57,26 @@ my $called_getProperties;
}
{
package WGT::Class::Atset;
use WebGUI::Definition::Asset;
attribute tableName => 'asset';
::dies_ok { property 'property1' => (); } 'must have a fieldType';
}
{
package WGT::Class::Asset;
use WebGUI::Definition::Asset;
attribute tableName => 'asset';
property 'property2' => ();
property 'property1' => ();
property 'property2' => (
fieldType => 'text',
);
property 'property1' => (
fieldType => 'text',
);
my $written;
sub write {
@ -129,17 +142,27 @@ my $called_getProperties;
use WebGUI::Definition::Asset;
attribute tableName => 'asset';
property 'property1' => ();
property 'property2' => ();
property 'property3' => ();
property 'property1' => (
fieldType => 'text'
);
property 'property2' => (
fieldType => 'text'
);
property 'property3' => (
fieldType => 'text'
);
package WGT::Class::Asset::Snippet;
use WebGUI::Definition::Asset;
extends 'WGT::Class::AlsoAsset';
attribute tableName => 'snippet';
property 'property10' => ();
property 'property11' => ();
property 'property10' => (
fieldType => 'text'
);
property 'property11' => (
fieldType => 'text'
);
package main;
@ -175,8 +198,12 @@ my $called_getProperties;
extends 'WGT::Class::AlsoAsset';
attribute tableName => 'snippet';
property 'property10' => ();
property 'property1' => ();
property 'property10' => (
fieldType => 'text',
);
property 'property1' => (
fieldType => 'text',
);
package main;