Set up filtering on title, menuTitle and URL. This is done via "around".

This commit is contained in:
Colin Kuskie 2009-12-18 12:59:01 -08:00
parent 0c4710c4ad
commit 0e90ad00b8
3 changed files with 74 additions and 61 deletions

View file

@ -91,12 +91,21 @@ my $called_getProperties;
property 'property2' => (
fieldType => 'text',
label => 'property2',
writer => '_set_property_2',
);
property 'property1' => (
fieldType => 'text',
label => 'property1',
);
my $filter2 = 0;
around 'property2' => sub {
my $orig = shift;
my $self = shift;
$filter2 = 1;
$self->$orig(@_);
};
my $written;
sub write {
$written++;
@ -122,6 +131,9 @@ my $called_getProperties;
$object->update;
::is $written, 1, 'update calls write';
$object->property2('foo');
::is $filter2, 1, 'around modifier works';
::is $object->tableName, 'asset', 'tableName set for object';
$object->tableName('not asset');
::is $object->tableName, 'asset', 'tableName may not be set from the object';