Added a new method to WebGUI::HTML called makeParameter safe. It will
encode commas and single quotes to make the output safe to embed inside of a macro. Added tests to verify that it works correctly. Updated the c_companyName macro to use makeParameterSafe. Added tests to verify that the changed macro works okay. Updated the c_companyName documentation. Added a blurb to the gotchas file to cover the change to the macro.
This commit is contained in:
parent
52a3023b09
commit
76585a1daa
7 changed files with 63 additions and 10 deletions
|
|
@ -20,20 +20,28 @@ use Test::More; # increment this value for each test you create
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $numTests = 1+1;
|
||||
my $numTests = 2+1;
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
my $macro = 'WebGUI::Macro::c_companyName';
|
||||
my $loaded = use_ok($macro);
|
||||
|
||||
my $originalCompanyName = $session->setting->get('companyName');
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
||||
|
||||
my ($value) = $session->dbSlave->quickArray(
|
||||
"select value from settings where name='companyName'");
|
||||
my $output = WebGUI::Macro::c_companyName::process($session);
|
||||
is($output, $value, sprintf "Testing companyName");
|
||||
is($output, $originalCompanyName, "Testing companyName");
|
||||
|
||||
$session->setting->set('companyName', q|Gooey's Consulting, LLC|);
|
||||
$output = WebGUI::Macro::c_companyName::process($session);
|
||||
is($output, q|Gooey"s Consulting, LLC|, "Testing companyName with embedded quote and comma");
|
||||
|
||||
}
|
||||
|
||||
END {
|
||||
$session->setting->set('companyName', $originalCompanyName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue