From b1bb5d0b5801c2732b02db50eb84e9d70178e75f Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 11 Oct 2006 00:32:42 +0000 Subject: [PATCH] Fix broken templateId in Session/Style/process when useEmptyStyle was requested. It used to be 6, but at somepoint in the 6.x cycle it was changed to be PBtmpl0000000000000132 in the database. Added tests that verify that it works correctly. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Session/Style.pm | 2 +- t/Session/Style.t | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 490a270ea..e540be5fb 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -12,6 +12,7 @@ - fix: Events Calendar: error in "big" template (Martin Kamerbeek / Procolix) - fix: PM task editor not preserving duration - fix: PM project completion percentage updates not working right + - fix: useEmptyStyle caused invalid template to be used - Added ability to download an SQLReport in either CSV or as a template. - Added ability for Products to add a user to a group when purchased. - Changed the ?op=editProduct form to a TabForm. diff --git a/lib/WebGUI/Session/Style.pm b/lib/WebGUI/Session/Style.pm index 4c775f677..575415e9a 100644 --- a/lib/WebGUI/Session/Style.pm +++ b/lib/WebGUI/Session/Style.pm @@ -159,7 +159,7 @@ sub process { } elsif ($self->session->scratch->get("personalStyleId") ne "") { $templateId = $self->session->scratch->get("personalStyleId"); } elsif ($self->{_useEmptyStyle}) { - $templateId = 6; + $templateId = 'PBtmpl0000000000000132'; } $var{'head.tags'} = ' diff --git a/t/Session/Style.t b/t/Session/Style.t index 927cf90b9..f724df5d0 100644 --- a/t/Session/Style.t +++ b/t/Session/Style.t @@ -18,7 +18,7 @@ use WebGUI::Session; use WebGUI::Asset; use WebGUI::VersionTag; -use Test::More tests => 38; # increment this value for each test you create +use Test::More tests => 39; # increment this value for each test you create use Test::Deep; my $session = WebGUI::Test->session; @@ -150,7 +150,8 @@ is($macroOutput, 1, 'generateAdditionalHeadTags: process a macro'); #################################################### # -# process +# process +# useEmptyStyle # #################################################### @@ -163,6 +164,10 @@ is($style->process('body.content', 'notATemplateId'), is($style->sent, 1, 'process: sets sent to 1'); +$style->useEmptyStyle(1); + +is($style->process('body.content'), "body.content", 'process, useEmptyStyle: valid data returned'); + my ($versionTag, $personalTemplate) = setup_assets($session); $session->scratch->set('personalStyleId', $personalTemplate->getId);