Add more AdminBar tests.
Fix adminbar macro to handle bad asset classes without dying.
This commit is contained in:
parent
98294e4e78
commit
8fa164200a
3 changed files with 16 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
|||
- fixed #9150: Edit Data Table - Cannot add column (David Delikat)
|
||||
- fixed #9261: Cart Payment Screen not templated
|
||||
- fixed #4124: Site starter uses floats in ways that cause problems
|
||||
- fixed #9274: AdminBar errors and fails when an asset class cannot be loaded
|
||||
|
||||
7.6.6
|
||||
- fixed #8792: Image Preview gives ERROR in Collateral Manager
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ sub process {
|
|||
my %assetList = %{$config->get('assets')};
|
||||
foreach my $assetClass (keys %assetList) {
|
||||
my $dummy = WebGUI::Asset->newByPropertyHashRef($session,{dummy=>1, className=>$assetClass});
|
||||
next unless defined $dummy;
|
||||
next if $dummy->getUiLevel($assetList{$assetClass}{uiLevel}) > $userUiLevel;
|
||||
next unless ($dummy->canAdd($session));
|
||||
next unless exists $categories{$assetList{$assetClass}{category}};
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use Test::More; # increment this value for each test you create
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $numTests = 0;
|
||||
my $numTests = 2;
|
||||
|
||||
$numTests += 1; #For the use_ok
|
||||
|
||||
|
|
@ -29,9 +29,22 @@ plan tests => $numTests;
|
|||
my $macro = 'WebGUI::Macro::AdminBar';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
my $originalAssets = $session->config->get('assets');
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
||||
|
||||
my $output;
|
||||
$output = WebGUI::Macro::AdminBar::process($session);
|
||||
is($output, undef, 'AdminBar returns undef unless admin is on');
|
||||
$session->var->switchAdminOn;
|
||||
$output = WebGUI::Macro::AdminBar::process($session);
|
||||
ok($output, 'AdminBar returns something when admin is on');
|
||||
|
||||
|
||||
}
|
||||
|
||||
END: {
|
||||
$session->config->set('assets', $originalAssets);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue