Skip to content

Commit dab6b20

Browse files
committed
MAGETWO-92931: HTML entities in product name do not display properly in breadcrumb
- fix unit test
1 parent eb8aa49 commit dab6b20

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/code/Magento/Catalog/Test/Unit/ViewModel/Product/BreadcrumbsTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,14 @@ protected function setUp() : void
5353
->disableOriginalConstructor()
5454
->getMockForAbstractClass();
5555

56+
$escaper = $this->getObjectManager()->getObject(\Magento\Framework\Escaper::class);
57+
5658
$this->viewModel = $this->getObjectManager()->getObject(
5759
Breadcrumbs::class,
5860
[
5961
'catalogData' => $this->catalogHelper,
6062
'scopeConfig' => $this->scopeConfig,
63+
'escaper' => $escaper
6164
]
6265
);
6366
}
@@ -154,16 +157,16 @@ public function productJsonEncodeDataProvider() : array
154157
],
155158
[
156159
$this->getObjectManager()->getObject(Product::class, ['data' => ['name' => 'Test "']]),
157-
'{"breadcrumbs":{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":"Test \""}}',
160+
'{"breadcrumbs":{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":"Test ""}}',
158161
],
159162
[
160163
$this->getObjectManager()->getObject(Product::class, ['data' => ['name' => 'Test <b>x</b>']]),
161164
'{"breadcrumbs":{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":'
162-
. '"Test \u003Cb\u003Ex\u003C\/b\u003E"}}',
165+
. '"Test &lt;b&gt;x&lt;\/b&gt;"}}',
163166
],
164167
[
165168
$this->getObjectManager()->getObject(Product::class, ['data' => ['name' => 'Test \'abc\'']]),
166-
'{"breadcrumbs":{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":"Test \'abc\'"}}'
169+
'{"breadcrumbs":{"categoryUrlSuffix":".\"html","userCategoryPathInUrl":0,"product":"Test &#039;abc&#039;"}}'
167170
],
168171
];
169172
}

0 commit comments

Comments
 (0)