Update tests for bad macros to check template attachments. Fixes bug #12087

This commit is contained in:
Colin Kuskie 2011-04-04 16:31:44 -07:00
parent 73261e4651
commit 83d1897852
6 changed files with 24 additions and 2 deletions

View file

@ -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

Binary file not shown.

View file

@ -52,10 +52,13 @@ my @templateLabels;
while (my $templateAsset = $getATemplate->()) {
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);
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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;
}