From 04ed78e8f1c2570c5625c28f8c68fa4a82a57eeb Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 21 Jan 2010 21:06:58 -0800 Subject: [PATCH] Remove use of getAttribute from Asset.pm. Tweak a few tests. --- lib/WebGUI/Asset.pm | 8 ++++---- t/Asset/Asset.t | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 0f34c8a84..ed9a63b8b 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -38,7 +38,7 @@ around title => sub { if (@_ > 0) { my $title = shift; $title = WebGUI::HTML::filter($title, 'all'); - $title = $self->meta->get_attribute('title')->default if $title eq ''; + $title = $self->meta->find_attribute_by_name('title')->default if $title eq ''; unshift @_, $title; } $self->$orig(@_); @@ -1114,7 +1114,7 @@ If this evaluates to True, then the smaller extras/adminConsole/small/assets.gif sub getIcon { my ($self, $small) = @_; - my $icon = $self->getAttribute("icon"); + my $icon = $self->icon; return $self->session->url->extras('assets/small/'.$icon) if ($small); return $self->session->url->extras('assets/'.$icon); } @@ -1181,7 +1181,7 @@ returning results. This allows very large sets of results to be handled in chun sub getIsa { my ($class, $session, $offset) = @_; - my $tableName = $class->getAttribute('tableName'); + my $tableName = $class->tableName; my $sql = "select distinct(assetId) from $tableName"; if (defined $offset) { $sql .= ' LIMIT '. $offset . ',1234567890'; @@ -1522,7 +1522,7 @@ sub getUiLevel { my $className = $self->get("className"); return $uiLevel # passed in || $self->session->config->get("assets/".$className."/uiLevel") # from config - || $self->getAttribute('uiLevel') # from definition + || $self->uiLevel # from definition || 1; # if all else fails } diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index d7b188fec..eecb052c0 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -56,7 +56,7 @@ note "loadModule"; # Test the default constructor my $defaultAsset = WebGUI::Asset->getDefault($session); -is($defaultAsset, 'WebGUI::Asset::Wobject::Layout'); +isa_ok($defaultAsset, 'WebGUI::Asset::Wobject::Layout'); # Test the new constructor my $assetId = "PBnav00000000000000001"; # one of the default nav assets @@ -192,7 +192,7 @@ ok( WebGUI::Asset->urlExists($session, $importUrl, {assetId => 'notAnWebGUI my $i18n = WebGUI::International->new($session, 'Asset_Wobject'); is($importNode->getName, $i18n->get('assetName', 'Asset_Folder'), 'getName: Returns the internationalized name of the Asset, core Asset'); -#is($canEditAsset->getName, $i18n->get('asset', 'Asset'), 'getName: Returns the internationalized name of the Asset, core Asset'); + ################################################################ # # addEditLabel @@ -382,7 +382,7 @@ TODO: { $session->user({ userId => 3 }); $session->var->switchAdminOff; -is($rootAsset->addMissing('/nowhereMan'), undef, q{addMissing doesn't return anything unless use is in Admin Mode}); +is($rootAsset->addMissing('/nowhereMan'), undef, q{addMissing doesn't return anything unless user is in Admin Mode}); $session->var->switchAdminOn; my $addMissing = $rootAsset->addMissing('/nowhereMan');