Skip to content

Commit 991ff13

Browse files
committed
Merge remote-tracking branch 'adobe-commerce-tier-4/ACP2E-2787' into Tier4-Kings-PR-03-05-2024
2 parents 76bf5ab + 187eb64 commit 991ff13

File tree

2 files changed

+70
-0
lines changed
  • app/code/Magento/Store/Ui/Component/Listing/Column/Store
  • dev/tests/integration/testsuite/Magento/Ui/Component/Listing/Column/Store

2 files changed

+70
-0
lines changed

app/code/Magento/Store/Ui/Component/Listing/Column/Store/Options.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ protected function sanitizeName($name)
8181
preg_match('/\$[:]*{(.)*}/', $name ?: '', $matches);
8282
if (count($matches) > 0) {
8383
$name = $this->escaper->escapeHtml($this->escaper->escapeJs($name));
84+
} elseif (preg_match("/^(?=.*')[a-zA-Z0-9' ]+$/", $name)) {
85+
return $name;
8486
} else {
8587
$name = $this->escaper->escapeHtml($name);
8688
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*
7+
* NOTICE: All information contained herein is, and remains
8+
* the property of Adobe and its suppliers, if any. The intellectual
9+
* and technical concepts contained herein are proprietary to Adobe
10+
* and its suppliers and are protected by all applicable intellectual
11+
* property laws, including trade secret and copyright laws.
12+
* Dissemination of this information or reproduction of this material
13+
* is strictly forbidden unless prior written permission is obtained
14+
* from Adobe.
15+
* ************************************************************************
16+
*/
17+
declare(strict_types=1);
18+
19+
namespace Magento\Ui\Component\Listing\Column\Store;
20+
21+
use Magento\Framework\Exception\LocalizedException;
22+
use Magento\Store\Test\Fixture\Store as StoreFixture;
23+
use Magento\Store\Ui\Component\Listing\Column\Store\Options;
24+
use Magento\TestFramework\Fixture\DataFixture;
25+
use Magento\TestFramework\Fixture\DataFixtureStorage;
26+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
27+
use Magento\TestFramework\Helper\Bootstrap;
28+
use PHPUnit\Framework\TestCase;
29+
30+
class OptionsTest extends TestCase
31+
{
32+
/**
33+
* @var DataFixtureStorage
34+
*/
35+
private $fixtures;
36+
37+
/**
38+
* @var Options
39+
*/
40+
private $storesList;
41+
42+
/**
43+
* @throws LocalizedException
44+
*/
45+
protected function setUp(): void
46+
{
47+
$objectManager = Bootstrap::getObjectManager();
48+
$this->fixtures = DataFixtureStorageManager::getStorage();
49+
$this->storesList = $objectManager->get(Options::class);
50+
}
51+
52+
#[
53+
DataFixture(StoreFixture::class, ["name" =>"Default's Store"], 'store'),
54+
]
55+
public function testStoreLabeleWithSingleQuote()
56+
{
57+
$storeName = $this->fixtures->get('store')->getName();
58+
$storeStructure = $this->storesList->toOptionArray();
59+
self::assertNotEmpty($storeStructure);
60+
$storeGroups = $storeStructure[0]['value'];
61+
foreach ($storeGroups as $storeGroup) {
62+
$storeViews = $storeGroup['value'];
63+
$storeLabels = array_column($storeViews, 'label');
64+
$expectedLabel = str_repeat(' ', 8) . $storeName;
65+
self::assertContainsEquals($expectedLabel, $storeLabels);
66+
}
67+
}
68+
}

0 commit comments

Comments
 (0)