|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Copyright © Magento, Inc. All rights reserved. |
4 | | - * See COPYING.txt for license details. |
| 3 | + * Copyright 2021 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */ |
6 | 6 | declare(strict_types=1); |
7 | 7 |
|
|
10 | 10 | use Magento\Catalog\Api\Data\CategoryInterface; |
11 | 11 | use Magento\CatalogWidget\Block\Product\ProductsList; |
12 | 12 | use Magento\Store\Model\Store; |
| 13 | +use Magento\TestFramework\Fixture\AppArea; |
| 14 | +use Magento\TestFramework\Fixture\Config; |
13 | 15 | use Magento\TestFramework\Helper\Bootstrap; |
| 16 | +use Magento\Widget\Model\Template\Filter; |
14 | 17 | use PHPUnit\Framework\TestCase; |
15 | 18 |
|
16 | 19 | /** |
@@ -291,4 +294,37 @@ public static function categoryFilterAndSortDataProvider(): array |
291 | 294 | ] |
292 | 295 | ]; |
293 | 296 | } |
| 297 | + |
| 298 | + #[ |
| 299 | + AppArea('frontend'), |
| 300 | + Config('dev/template/minify_html', 1, 'store', 'default') |
| 301 | + ] |
| 302 | + public function testWidgetWithMinification() |
| 303 | + { |
| 304 | + /** @var Filter $filter */ |
| 305 | + $filter = Bootstrap::getObjectManager()->create( |
| 306 | + Filter::class |
| 307 | + ); |
| 308 | + $notExistedSku = uniqid(); |
| 309 | + $construction = [ |
| 310 | + 0 => '{{widget type="Magento\CatalogWidget\Block\Product\ProductsList" ' . |
| 311 | + 'template="Magento_PageBuilder::catalog/product/widget/content/carousel.phtml" anchor_text="" ' . |
| 312 | + 'id_path="" show_pager="0" products_count="20" condition_option="sku" condition_option_value="' . |
| 313 | + $notExistedSku . '" ' . |
| 314 | + 'type_name="Catalog Products Carousel" conditions_encoded="^[`1`:^[`aggregator`:`all`,`new_child`:``,' . |
| 315 | + '`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`,`value`:`1`^],`1--1`:' . |
| 316 | + '^[`operator`:`()`,`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`,`attribute`:`sku`' . |
| 317 | + ',`value`:`' . $notExistedSku . '`^]^]" sort_order="position_by_sku" store_id="0"}}', |
| 318 | + 1 => 'widget', |
| 319 | + 2 => 'type="Magento\CatalogWidget\Block\Product\ProductsList" ' . |
| 320 | + 'template="Magento_PageBuilder::catalog/product/widget/content/carousel.phtml" anchor_text="" ' . |
| 321 | + 'id_path="" show_pager="0" products_count="20" condition_option="sku" condition_option_value="' . |
| 322 | + $notExistedSku . '" ' . |
| 323 | + 'type_name="Catalog Products Carousel" conditions_encoded="^[`1`:^[`aggregator`:`all`,`new_child`:``,' . |
| 324 | + '`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`,`value`:`1`^],`1--1`:' . |
| 325 | + '^[`operator`:`()`,`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`,`attribute`:' . |
| 326 | + '`sku`,`value`:`' . $notExistedSku . '`^]^]" sort_order="position_by_sku" store_id="0"' |
| 327 | + ]; |
| 328 | + $this->assertEquals('', $filter->generateWidget($construction)); |
| 329 | + } |
294 | 330 | } |
0 commit comments