More tests for tableName, getProperty.
This commit is contained in:
parent
c93bdc7950
commit
f997981d73
1 changed files with 16 additions and 0 deletions
|
|
@ -74,6 +74,10 @@ my $called_getProperties;
|
|||
::isa_ok +__PACKAGE__->getProperty('property1'), 'WebGUI::Definition::Meta::Property::Asset';
|
||||
|
||||
::can_ok +__PACKAGE__, 'update';
|
||||
::can_ok +__PACKAGE__, 'tableName';
|
||||
|
||||
::can_ok +__PACKAGE__->getProperty('property1'), 'tableName';
|
||||
::is +__PACKAGE__->getProperty('property1')->tableName, 'asset', 'tableName set on property to asset';
|
||||
|
||||
my $object = __PACKAGE__->new;
|
||||
$object->set({property1 => 'property value'});
|
||||
|
|
@ -86,6 +90,13 @@ my $called_getProperties;
|
|||
$object->update;
|
||||
::is $written, 1, 'update calls write';
|
||||
|
||||
::is $object->tableName, 'asset', 'tableName set for object';
|
||||
$object->tableName('not asset');
|
||||
::is $object->tableName, 'asset', 'tableName may not be set from the object';
|
||||
$object->meta->tableName('not asset');
|
||||
::is $object->tableName, 'not asset', 'object can access meta and change the table';
|
||||
$object->meta->tableName('asset');
|
||||
|
||||
::cmp_deeply(
|
||||
[ $object->meta->get_property_list ],
|
||||
[qw/property2 property1/],
|
||||
|
|
@ -132,6 +143,11 @@ my $called_getProperties;
|
|||
|
||||
package main;
|
||||
|
||||
is +WGT::Class::AlsoAsset->getProperty('property1')->tableName, 'asset', 'tableName set in base class';
|
||||
|
||||
is +WGT::Class::Asset::Snippet->getProperty('property10')->tableName, 'snippet', 'tableName set in subclass';
|
||||
is +WGT::Class::Asset::Snippet->getProperty('property1')->tableName, 'asset', '... but inherited properties keep their tableName';
|
||||
|
||||
cmp_bag(
|
||||
[ map {$_->name} WGT::Class::AlsoAsset->meta->get_attributes ],
|
||||
[qw/property1 property2 property3/],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue