From 83d189785264290fcbf80ff5ac5dd7ef384ab9c2 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 4 Apr 2011 16:31:44 -0700 Subject: [PATCH] Update tests for bad macros to check template attachments. Fixes bug #12087 --- docs/changelog/7.x.x.txt | 1 + .../packages-7.10.13/default_search2.wgpkg | Bin 0 -> 1811 bytes t/badExtrasMacros.t | 5 ++++- t/badGatewayMacros.t | 3 +++ t/hardcodedExtras.t | 10 ++++++++++ t/rawHrefUrls.t | 7 ++++++- 6 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 docs/upgrades/packages-7.10.13/default_search2.wgpkg diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index c79fa0eec..813e3fe41 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -9,6 +9,7 @@ - fixed #12089: Cannot refund item in transaction if the sku no longer exists. - rfe #12085: Export Related Story Topics - fixed #12076: Paginator shows no results with cached page index + - fixed #12087: Extend WebGUI tests to check template attachments 7.10.12 - fixed #12072: Product, related and accessory assets diff --git a/docs/upgrades/packages-7.10.13/default_search2.wgpkg b/docs/upgrades/packages-7.10.13/default_search2.wgpkg new file mode 100644 index 0000000000000000000000000000000000000000..faee2be099ff232a056c2e7d1eba72dcd0fec0bb GIT binary patch literal 1811 zcmV+u2kiJCiwFP!00000|Ls_9Q`<%m_UHTx)nAg#1Y7b8#E$BjBn^cYQW{9iF~B0}wzf4jZ(ck6Ghoy$7=KVkSRsYugL%)j% zA0NOWY-*!oHseia=)8OXgqEUMMLafwYg{EY)SSee86Lb?;cBznBxMwYOq*9%k%~e3 zoNQzghJ`qbuphj-Vv8uGP&EbcOHQNYJQRA)gVMR=%Tpl(wIl_%6zG*ykrwOm_?3y- z9%sP`o9QDqxd3;7xDrw=C6C|2x!xz4y_<^pnjzDgo6P9wg@OIhp~?SrTnk|mhXgv{ zQezo?Wuo$+ob^uSVmhGlA;qLTlU{jpbPS%#m!tVOa!ghG<2OH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MLv%)>R-p+Qf)9YAV4k!~a-wfXL%*es+R2@%$ zJ^i!S-F@1()) { my $template = $templateAsset->get('template'); my $header = $templateAsset->get('extraHeadTags'); - my $match = ($template =~ $macro); + my $match = ($template =~ $macro); if ($header) { $match ||= ($header =~ $macro); } + foreach my $attachment (@{ $templateAsset->getAttachments }) { + $match ||= ($attachment->{url} =~ $macro); + } ok(!$match, sprintf "%s: %s (%s) has no bad extras macros", $templateAsset->getTitle, $templateAsset->getId, $templateAsset->getUrl); } diff --git a/t/badGatewayMacros.t b/t/badGatewayMacros.t index 4fbbbeaf6..2d74ec74c 100644 --- a/t/badGatewayMacros.t +++ b/t/badGatewayMacros.t @@ -55,6 +55,9 @@ while (my $templateAsset = $getATemplate->()) { if ($header) { $match ||= ($header =~ $macro); } + foreach my $attachment (@{ $templateAsset->getAttachments }) { + $match ||= ($attachment->{url} =~ $macro); + } ok(!$match, sprintf "%s: %s (%s) has no bad gateway macros", $templateAsset->getTitle, $templateAsset->getId, $templateAsset->getUrl); } diff --git a/t/hardcodedExtras.t b/t/hardcodedExtras.t index a4c6788e2..ca30a269d 100644 --- a/t/hardcodedExtras.t +++ b/t/hardcodedExtras.t @@ -45,6 +45,16 @@ TEMPLATE: while (my $templateAsset = $getATemplate->()) { type => 'Template', } } + foreach my $attachment (@{ $templateAsset->getAttachments }) { + if ($attachment->{url} =~ m!$hardcodedExtras! ) { + push @hardcodedExtras, { + url => $templateAsset->getUrl, + id => $templateAsset->getId, + title => $templateAsset->getTitle, + type => 'Template', + } + } + } } my $getASnippet = WebGUI::Asset::Snippet->getIsa($session); diff --git a/t/rawHrefUrls.t b/t/rawHrefUrls.t index 8d9011818..ec0dc6537 100644 --- a/t/rawHrefUrls.t +++ b/t/rawHrefUrls.t @@ -38,7 +38,7 @@ my $macro = qr{ $numTests = $session->db->quickScalar('select count(distinct(assetId)) from template'); -plan tests => 2*$numTests; +plan tests => 3*$numTests; my $validLinks = 0; @@ -91,4 +91,9 @@ TEMPLATE: while (my $templateAsset = $getATemplate->()) { $parser->parse($template); ok($validLinks, sprintf "%s: %s (%s) has no rooted link urls in the template", $templateAsset->getTitle, $templateAsset->getId, $templateAsset->getUrl); } + my $bad_attachments = 0; + foreach my $attachment (@{ $templateAsset->getAttachments }) { + ++$bad_attachments if $attachment->{url} !~ $nonRootLink; + } + ok $bad_attachments == 0, sprintf "%s: %s (%s) has no rooted link urls in the template attachments", $templateAsset->getTitle, $templateAsset->getId, $templateAsset->getUrl; }