- fixed #12365: editing a metadata category may cause a fatal error

This commit is contained in:
Arjan Widlak 2012-06-05 12:34:50 +02:00
parent 8370cb15c8
commit 7ab4726600
3 changed files with 19 additions and 2 deletions

View file

@ -24,7 +24,7 @@ use WebGUI::VersionTag;
use Test::More; # increment this value for each test you create
use Test::Deep;
plan tests => 16;
plan tests => 17;
my $session = WebGUI::Test->session;
$session->user({userId => 3});
@ -305,6 +305,21 @@ subtest 'asset metadata versioning' => sub {
is $count_all->($dup), 1, 'one value for dup';
};
# Check that www_editMetaDataField doesn't return assets that are not configured
# for this site and that sub definition is not executed if the asset is not
# configured in the config, which may cause a fatal error.
# Temporarily remove asset Article from config
$session->config->deleteFromHash( 'assets', 'WebGUI::Asset::Wobject::Article' );
unlike(
my $got = $root->www_editMetaDataField(),
qr/WebGUI::Asset::Wobject::Article/,
'article was (temporarily) not in config and should not appear in form'
);
# Restore config:
$session->config->addToHash( 'assets', 'WebGUI::Asset::Wobject::Article' );
sub buildNameIndex {
my ($fidStruct) = @_;
my $nameStruct;