Skip to content

Commit 4959aa5

Browse files
Indrani SonawaneIndrani Sonawane
authored andcommitted
Fixed static test failures
1 parent 5e901d4 commit 4959aa5

File tree

3 files changed

+38
-34
lines changed

3 files changed

+38
-34
lines changed

app/code/Magento/Review/view/frontend/templates/helper/summary.phtml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/**
88
* @var \Magento\Review\Block\Product\ReviewRenderer $block
99
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
10+
* @var \Magento\Framework\Escaper $escaper
1011
*/
1112

1213
$url = $block->getReviewsUrl() . '#reviews';
@@ -18,13 +19,13 @@ $urlForm = $block->getReviewsUrl() . '#review-form';
1819
itemtype="http://schema.org/AggregateRating">
1920
<?php if ($rating):?>
2021
<div class="rating-summary">
21-
<span class="label"><span><?= $block->escapeHtml(__('Rating')) ?>:</span></span>
22+
<span class="label"><span><?= $escaper->escapeHtml(__('Rating')) ?>:</span></span>
2223
<div class="rating-result"
23-
id="rating-result_<?= $block->escapeHtmlAttr($block->getProduct()->getId()) ?>"
24-
title="<?= $block->escapeHtmlAttr($rating); ?>%">
25-
<span style="width: <?= $block->escapeHtmlAttr($rating); ?>%;">
24+
id="rating-result_<?= $escaper->escapeHtmlAttr($block->getProduct()->getId()) ?>"
25+
title="<?= $escaper->escapeHtmlAttr($rating); ?>%">
26+
<span style="width: <?= $escaper->escapeHtmlAttr($rating); ?>%;">
2627
<span>
27-
<span itemprop="ratingValue"><?= $block->escapeHtml($rating); ?>
28+
<span itemprop="ratingValue"><?= $escaper->escapeHtml($rating); ?>
2829
</span>% of <span itemprop="bestRating">100</span>
2930
</span>
3031
</span>
@@ -33,22 +34,22 @@ $urlForm = $block->getReviewsUrl() . '#review-form';
3334
<?php endif;?>
3435
<div class="reviews-actions">
3536
<a class="action view"
36-
href="<?= $block->escapeUrl($url) ?>">
37-
<span itemprop="reviewCount"><?= $block->escapeHtml($block->getReviewsCount()) ?></span>&nbsp;
38-
<span><?= ($block->getReviewsCount() == 1) ? $block->escapeHtml(__('Review')) :
39-
$block->escapeHtml(__('Reviews')) ?>
37+
href="<?= $escaper->escapeUrl($url) ?>">
38+
<span itemprop="reviewCount"><?= $escaper->escapeHtml($block->getReviewsCount()) ?></span>&nbsp;
39+
<span><?= ($block->getReviewsCount() == 1) ? $escaper->escapeHtml(__('Review')) :
40+
$escaper->escapeHtml(__('Reviews')) ?>
4041
</span>
4142
</a>
42-
<a class="action add" href="<?= $block->escapeUrl($urlForm) ?>">
43-
<?= $block->escapeHtml(__('Add Your Review')) ?>
43+
<a class="action add" href="<?= $escaper->escapeUrl($urlForm) ?>">
44+
<?= $escaper->escapeHtml(__('Add Your Review')) ?>
4445
</a>
4546
</div>
4647
</div>
4748
<?php elseif ($block->isReviewEnabled() && $block->getDisplayIfEmpty()): ?>
4849
<div class="product-reviews-summary empty">
4950
<div class="reviews-actions">
50-
<a class="action add" href="<?= $block->escapeUrl($urlForm) ?>">
51-
<?= $block->escapeHtml(__('Be the first to review this product')) ?>
51+
<a class="action add" href="<?= $escaper->escapeUrl($urlForm) ?>">
52+
<?= $escaper->escapeHtml(__('Be the first to review this product')) ?>
5253
</a>
5354
</div>
5455
</div>

app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/** @var \Magento\Review\Block\Product\ReviewRenderer $block */
88
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
9+
/** @var \Magento\Framework\Escaper $escaper */
910

1011
$url = $block->getReviewsUrl() . '#reviews';
1112
$urlForm = $block->getReviewsUrl() . '#review-form';
@@ -15,30 +16,30 @@ $urlForm = $block->getReviewsUrl() . '#review-form';
1516
<div class="product-reviews-summary short<?= !$rating ? ' no-rating' : '' ?>">
1617
<?php if ($rating):?>
1718
<div class="rating-summary">
18-
<span class="label"><span><?= $block->escapeHtml(__('Rating')) ?>:</span></span>
19+
<span class="label"><span><?= $escaper->escapeHtml(__('Rating')) ?>:</span></span>
1920
<div class="rating-result"
2021
id="rating-result_<?= /* @noEscape */ $block->getProduct()->getId() ?>"
21-
title="<?= $block->escapeHtmlAttr($rating) ?>%">
22-
<span style="width: <?= $block->escapeHtmlAttr($rating) ?>%;">
23-
<span><?= $block->escapeHtml($rating) ?>%</span>
22+
title="<?= $escaper->escapeHtmlAttr($rating) ?>%">
23+
<span style="width: <?= $escaper->escapeHtmlAttr($rating) ?>%;">
24+
<span><?= $escaper->escapeHtml($rating) ?>%</span>
2425
</span>
2526
</div>
2627
</div>
2728
<?php endif;?>
2829
<div class="reviews-actions">
2930
<a class="action view"
30-
href="<?= $block->escapeUrl($url) ?>"><?= $block->escapeHtml($block->getReviewsCount()) ?>
31+
href="<?= $escaper->escapeUrl($url) ?>"><?= $escaper->escapeHtml($block->getReviewsCount()) ?>
3132
&nbsp;<span><?= ($block->getReviewsCount() == 1) ?
32-
$block->escapeHtml(__('Review')) : $block->escapeHtml(__('Reviews')) ?>
33+
$escaper->escapeHtml(__('Review')) : $escaper->escapeHtml(__('Reviews')) ?>
3334
</span>
3435
</a>
3536
</div>
3637
</div>
3738
<?php elseif ($block->isReviewEnabled() && $block->getDisplayIfEmpty()): ?>
3839
<div class="product-reviews-summary short empty">
3940
<div class="reviews-actions">
40-
<a class="action add" href="<?= $block->escapeUrl($urlForm) ?>">
41-
<?= $block->escapeHtml(__('Be the first to review this product')) ?>
41+
<a class="action add" href="<?= $escaper->escapeUrl($urlForm) ?>">
42+
<?= $escaper->escapeHtml(__('Be the first to review this product')) ?>
4243
</a>
4344
</div>
4445
</div>

app/code/Magento/Review/view/frontend/templates/view.phtml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,43 @@
77
/**
88
* @var \Magento\Review\Block\View $block
99
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
10+
* @var \Magento\Framework\Escaper $escaper
1011
*/
1112
?>
1213
<?php if ($block->getProductData()->getId()): ?>
1314
<div class="product-review">
1415
<div class="page-title-wrapper">
15-
<h1><?= $block->escapeHtml(__('Review Details')) ?></h1>
16+
<h1><?= $escaper->escapeHtml(__('Review Details')) ?></h1>
1617
</div>
1718
<div class="product-img-box">
18-
<a href="<?= $block->escapeUrl($block->getProductData()->getProductUrl()) ?>">
19-
<?= $block->getImage($block->getProductData(), 'product_base_image', ['class' => 'product-image'])->toHtml()
19+
<a href="<?= $escaper->escapeUrl($block->getProductData()->getProductUrl()) ?>">
20+
<?= $block->getImage($block->getProductData(), 'product_base_image', [
21+
'class' => 'product-image'])->toHtml()
2022
?>
2123
</a>
2224
<?php if ($block->getRating() && $block->getRating()->getSize()): ?>
23-
<p><?= $block->escapeHtml(__('Average Customer Rating')) ?>:</p>
25+
<p><?= $escaper->escapeHtml(__('Average Customer Rating')) ?>:</p>
2426
<?= $block->getReviewsSummaryHtml($block->getProductData()) ?>
2527
<?php endif; ?>
2628
</div>
2729
<div class="details">
28-
<h3 class="product-name"><?= $block->escapeHtml($block->getProductData()->getName()) ?></h3>
30+
<h3 class="product-name"><?= $escaper->escapeHtml($block->getProductData()->getName()) ?></h3>
2931
<?php if ($block->getRating() && $block->getRating()->getSize()): ?>
30-
<h4><?= $block->escapeHtml(__('Product Rating:')) ?></h4>
32+
<h4><?= $escaper->escapeHtml(__('Product Rating:')) ?></h4>
3133
<div class="table-wrapper">
3234
<table class="data-table review-summary-table">
33-
<caption class="table-caption"><?= $block->escapeHtml(__('Product Rating')) ?></caption>
35+
<caption class="table-caption"><?= $escaper->escapeHtml(__('Product Rating')) ?></caption>
3436
<?php foreach ($block->getRating() as $_rating): ?>
3537
<?php if ($_rating->getPercent()): ?>
3638
<?php $rating = ceil($_rating->getPercent()) ?>
3739
<tr>
3840
<td class="label" width="10%">
39-
<?= $block->escapeHtml(__($_rating->getRatingCode())) ?>
41+
<?= $escaper->escapeHtml(__($_rating->getRatingCode())) ?>
4042
</td>
4143
<td class="value">
4244
<?php $ratingId = $_rating->getRatingId() ?>
4345
<div class="rating-summary item"
44-
id="rating-div-<?= $block->escapeHtml($ratingId) ?>">
46+
id="rating-div-<?= $escaper->escapeHtml($ratingId) ?>">
4547
<div class="rating-result" title="<?= /* @noEscape */ $rating ?>%">
4648
<span style="width: <?= /* @noEscape */ $rating ?>%;">
4749
<span><?= /* @noEscape */ $rating ?>%</span>
@@ -56,16 +58,16 @@
5658
</div>
5759
<?php endif; ?>
5860
<p class="date">
59-
<?= $block->escapeHtml(
61+
<?= $escaper->escapeHtml(
6062
__('Product Review (submitted on %1):', $block->dateFormat($block->getReviewData()->getCreatedAt()))
6163
) ?>
6264
</p>
63-
<p><?= /* @noEscape */ nl2br($block->escapeHtml($block->getReviewData()->getDetail())) ?></p>
65+
<p><?= /* @noEscape */ nl2br($escaper->escapeHtml($block->getReviewData()->getDetail())) ?></p>
6466
</div>
6567
<div class="actions">
6668
<div class="secondary">
67-
<a class="action back" href="<?= $block->escapeUrl($block->getBackUrl()) ?>">
68-
<span><?= $block->escapeHtml(__('Back to Product Reviews')) ?></span>
69+
<a class="action back" href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>">
70+
<span><?= $escaper->escapeHtml(__('Back to Product Reviews')) ?></span>
6971
</a>
7072
</div>
7173
</div>

0 commit comments

Comments
 (0)