Setup keywords as a string, not an array ref. Add tests for that.

This commit is contained in:
Colin Kuskie 2010-06-09 18:58:01 -07:00
parent 0578a55419
commit 705f0d49ba
2 changed files with 6 additions and 6 deletions

View file

@ -315,7 +315,7 @@ sub _build_assetKeywords {
my $self = shift; my $self = shift;
my $session = $self->session; my $session = $self->session;
my $keywords = WebGUI::Keyword->new($session); my $keywords = WebGUI::Keyword->new($session);
return $keywords->getKeywordsForAsset({asset => $self, asArrayRef => 1 }); return $keywords->getKeywordsForAsset({asset => $self, });
} }
around BUILDARGS => sub { around BUILDARGS => sub {

View file

@ -363,16 +363,16 @@ my $session = WebGUI::Test->session;
}); });
WebGUI::Test->addToCleanup($asset); WebGUI::Test->addToCleanup($asset);
can_ok($asset, 'keywords'); can_ok($asset, 'keywords');
$asset->keywords('chess set'); $asset->keywords('chess set, checkers board');
is ($asset->keywords, 'chess set', 'set and get of keywords via direct accessor'); is ($asset->keywords, 'chess set, checkers board', 'set and get of keywords via direct accessor');
is ($asset->get('keywords'), 'chess set', 'via get method'); is ($asset->get('keywords'), 'chess set, checkers board', 'via get method');
my $keygate = WebGUI::Keyword->new($session); my $keygate = WebGUI::Keyword->new($session);
is $keygate->getKeywordsForAsset({assetId => $asset->getId}), '', 'not persisted to the db'; is $keygate->getKeywordsForAsset({assetId => $asset->getId}), '', 'not persisted to the db';
$asset->write; $asset->write;
is $keygate->getKeywordsForAsset({assetId => $asset->assetId}), 'chess set', 'written to the db'; is $keygate->getKeywordsForAsset({assetId => $asset->assetId}), 'checkers board, chess set', 'written to the db';
my $asset_copy = $asset->cloneFromDb; my $asset_copy = $asset->cloneFromDb;
is $asset->keywords, 'chess set', 'refreshed from db'; is $asset->keywords, 'chess set, checkers board', 'refreshed from db';
my $asset2 = $default->addChild({ my $asset2 = $default->addChild({
className => 'WebGUI::Asset::Snippet', className => 'WebGUI::Asset::Snippet',