Add assetId attribute to Asset.pm, and tests.
This commit is contained in:
parent
f76842f705
commit
38144bd58f
2 changed files with 13 additions and 3 deletions
|
|
@ -236,6 +236,12 @@ property assetSize => (
|
|||
);
|
||||
has session => (
|
||||
is => 'ro',
|
||||
required => 1,
|
||||
);
|
||||
has assetId => (
|
||||
is => 'ro',
|
||||
lazy => 1,
|
||||
default => sub { shift->session->id->generate() },
|
||||
);
|
||||
|
||||
around BUILDARGS => sub {
|
||||
|
|
@ -1054,7 +1060,7 @@ Returns the assetId of an Asset.
|
|||
|
||||
sub getId {
|
||||
my $self = shift;
|
||||
return $self->get("assetId");
|
||||
return $self->assetId;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use Test::More;
|
|||
use Test::Deep;
|
||||
use Test::Exception;
|
||||
|
||||
plan tests => 17;
|
||||
plan tests => 20;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
@ -47,6 +47,10 @@ my $session = WebGUI::Test->session;
|
|||
is $asset->get('title'), $asset->title, '... get(title) works';
|
||||
|
||||
is $asset->menuTitle, 'Untitled', 'menuTitle: default is untitled';
|
||||
|
||||
can_ok $asset, qw/assetId getId/;
|
||||
ok $session->id->valid( $asset->assetId), 'assetId generated by default is valid';
|
||||
is $asset->assetId, $asset->getId, '... getId is an alias for assetId';
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -69,7 +73,7 @@ my $session = WebGUI::Test->session;
|
|||
$asset->menuTitle('<h1></h1>');
|
||||
is $asset->menuTitle, 'asset title', '... if HTML filters out all, returns default';
|
||||
|
||||
my $asset = WebGUI::Asset->new({
|
||||
$asset = WebGUI::Asset->new({
|
||||
session => $session,
|
||||
title => 'asset title',
|
||||
menuTitle => 'menuTitle asset',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue