change the name attribute to aspect to denote asset level static attributes like tableName, et. al.
This commit is contained in:
parent
5b24340994
commit
d4f31870a3
12 changed files with 72 additions and 43 deletions
|
|
@ -16,7 +16,7 @@ use lib "$FindBin::Bin/lib";
|
|||
|
||||
use WebGUI::Test;
|
||||
|
||||
use Test::More tests => 10;
|
||||
use Test::More tests => 12;
|
||||
use Test::Deep;
|
||||
use Test::Exception;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ my $called_getProperties;
|
|||
package WGT::Class;
|
||||
use WebGUI::Definition;
|
||||
|
||||
attribute 'attribute1' => 'attribute1 value';
|
||||
aspect 'aspect1' => 'aspect1 value';
|
||||
property 'property1' => (
|
||||
arbitrary_key => 'arbitrary_value',
|
||||
label => 'property1',
|
||||
|
|
@ -37,8 +37,8 @@ my $called_getProperties;
|
|||
label => 'property2',
|
||||
);
|
||||
|
||||
# attributes create methods
|
||||
::can_ok +__PACKAGE__, 'attribute1';
|
||||
# aspects create methods
|
||||
::can_ok +__PACKAGE__, 'aspect1';
|
||||
|
||||
# propeties create methods
|
||||
::can_ok +__PACKAGE__, 'property1';
|
||||
|
|
@ -60,7 +60,7 @@ my $called_getProperties;
|
|||
package WGT::Class2;
|
||||
use WebGUI::Definition;
|
||||
|
||||
attribute 'attribute1' => 'attribute1 value';
|
||||
aspect 'aspect1' => 'aspect1 value';
|
||||
property 'property3' => ( label => 'label' );
|
||||
property 'property1' => ( label => 'label' );
|
||||
property 'property2' => ( label => 'label' );
|
||||
|
|
@ -102,7 +102,7 @@ my $called_getProperties;
|
|||
package WGT::Class3;
|
||||
use WebGUI::Definition;
|
||||
|
||||
attribute 'attribute1' => 'attribute1 value';
|
||||
aspect 'aspect1' => 'aspect1 value';
|
||||
property 'property1' => (
|
||||
label => ['webgui', 'WebGUI'],
|
||||
options => \&property1_options,
|
||||
|
|
@ -127,3 +127,32 @@ my $called_getProperties;
|
|||
);
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
package WGT::Class4;
|
||||
use WebGUI::Definition;
|
||||
extends 'WGT::Class3';
|
||||
|
||||
aspect 'aspect41' => 'aspect41 value';
|
||||
property 'property41' => (
|
||||
label => ['webgui', 'WebGUI'],
|
||||
);
|
||||
has something => (
|
||||
is => 'rw',
|
||||
);
|
||||
|
||||
my $object3 = WGT::Class3->new({session => $session});
|
||||
my $object4 = WGT::Class4->new({session => $session});
|
||||
|
||||
::cmp_bag (
|
||||
[WGT::Class3->meta->get_all_attributes_list],
|
||||
[qw/ property1 session /],
|
||||
'get_all_aspects_list returns all aspects in all metaclasses for the class'
|
||||
);
|
||||
|
||||
::cmp_bag (
|
||||
[WGT::Class4->meta->get_all_attributes_list],
|
||||
[qw/ property41 something property1 session /],
|
||||
'... checking inherited class'
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use WebGUI::Test;
|
|||
package WGT::Class::Atset;
|
||||
use WebGUI::Definition::Asset;
|
||||
|
||||
attribute tableName => 'asset';
|
||||
aspect tableName => 'asset';
|
||||
::dies_ok { property 'property1' => (); } 'must have a fieldType';
|
||||
::dies_ok { property 'property1' => (fieldType => 'text'); } 'must pass either a label or noFormPost flag';
|
||||
::lives_ok { property 'property1' => (
|
||||
|
|
@ -44,7 +44,7 @@ use WebGUI::Test;
|
|||
package WGT::Class::Asset;
|
||||
use WebGUI::Definition::Asset;
|
||||
|
||||
attribute tableName => 'asset';
|
||||
aspect tableName => 'asset';
|
||||
property 'property2' => (
|
||||
fieldType => 'text',
|
||||
label => 'property2',
|
||||
|
|
@ -142,7 +142,7 @@ use WebGUI::Test;
|
|||
package WGT::Class::AlsoAsset;
|
||||
use WebGUI::Definition::Asset;
|
||||
|
||||
attribute tableName => 'asset';
|
||||
aspect tableName => 'asset';
|
||||
property 'property1' => (
|
||||
fieldType => 'text',
|
||||
label => 'property1',
|
||||
|
|
@ -160,7 +160,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Definition::Asset;
|
||||
extends 'WGT::Class::AlsoAsset';
|
||||
|
||||
attribute tableName => 'snippet';
|
||||
aspect tableName => 'snippet';
|
||||
property 'property10' => (
|
||||
fieldType => 'text',
|
||||
label => 'property10',
|
||||
|
|
@ -215,7 +215,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Definition::Asset;
|
||||
extends 'WGT::Class::AlsoAsset';
|
||||
|
||||
attribute tableName => 'snippet';
|
||||
aspect tableName => 'snippet';
|
||||
property 'property10' => (
|
||||
fieldType => 'text',
|
||||
label => 'property10',
|
||||
|
|
@ -241,7 +241,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Definition::Asset;
|
||||
extends 'WGT::Class::AlsoAsset';
|
||||
|
||||
attribute tableName => 'tertius';
|
||||
aspect tableName => 'tertius';
|
||||
property 'defaulted' => (
|
||||
fieldType => 'text',
|
||||
label => 'defaulted',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue