Skip to content

Commit ed998c3

Browse files
committed
ACP2E-2770: Double-byte characters (special characters) in Product Name field blocks product creation in backend
1 parent 30fbdcb commit ed998c3

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

app/code/Magento/Catalog/Helper/Product.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class Product extends \Magento\Framework\Url\Helper\Data
4949
protected $_assetRepo;
5050

5151
/**
52-
* Core registry
53-
*
5452
* @var \Magento\Framework\Registry
5553
*/
5654
protected $_coreRegistry;
@@ -61,8 +59,6 @@ class Product extends \Magento\Framework\Url\Helper\Data
6159
protected $_attributeConfig;
6260

6361
/**
64-
* Catalog session
65-
*
6662
* @var \Magento\Catalog\Model\Session
6763
*/
6864
protected $_catalogSession;

app/code/Magento/Catalog/Test/Unit/Model/Product/UrlTest.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Model\Product;
1212
use Magento\Catalog\Model\Product\Url;
1313
use Magento\Catalog\Model\Product\Url as ProductUrl;
14+
use Magento\Framework\App\Config\ScopeConfigInterface;
1415
use Magento\Framework\Filter\FilterManager;
1516
use Magento\Framework\Session\SidResolverInterface;
1617
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
@@ -53,6 +54,11 @@ class UrlTest extends TestCase
5354
*/
5455
protected $sidResolver;
5556

57+
/**
58+
* @var ScopeConfigInterface
59+
*/
60+
private ScopeConfigInterface $scopeConfig;
61+
5662
protected function setUp(): void
5763
{
5864
$this->filter = $this->getMockBuilder(
@@ -87,6 +93,8 @@ protected function setUp(): void
8793
$urlFactory->method('create')
8894
->willReturn($this->url);
8995

96+
$this->scopeConfig = $this->createMock(ScopeConfigInterface::class);
97+
9098
$objectManager = new ObjectManager($this);
9199
$this->model = $objectManager->getObject(
92100
ProductUrl::class,
@@ -96,11 +104,15 @@ protected function setUp(): void
96104
'storeManager' => $storeManager,
97105
'urlFactory' => $urlFactory,
98106
'sidResolver' => $this->sidResolver,
107+
'scopeConfig' => $this->scopeConfig
99108
]
100109
);
101110
}
102111

103-
public function testFormatUrlKey()
112+
/**
113+
* @return void
114+
*/
115+
public function testFormatUrlKey(): void
104116
{
105117
$strIn = 'Some string';
106118
$resultString = 'some';
@@ -115,6 +127,12 @@ public function testFormatUrlKey()
115127
$resultString
116128
);
117129

130+
$this->scopeConfig->expects($this->once())
131+
->method('getValue')
132+
->with(
133+
\Magento\Catalog\Helper\Product::XML_PATH_APPLY_TRANSLITERATION_TO_URL,
134+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
135+
)->willReturn(true);
118136
$this->assertEquals($resultString, $this->model->formatUrlKey($strIn));
119137
}
120138

0 commit comments

Comments
 (0)