File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,10 @@ public function formatUrlKey($str)
119
119
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
120
120
)) {
121
121
return $ this ->filter ->translitUrl ($ str );
122
+ } else {
123
+ $ str = preg_replace ('/\s+/ ' , '- ' , $ str );
124
+ $ str = mb_strtolower ($ str );
125
+ $ str = trim ($ str , '- ' );
122
126
}
123
127
124
128
return $ str ;
Original file line number Diff line number Diff line change @@ -139,6 +139,23 @@ public function testFormatUrlKey(): void
139
139
$ this ->assertEquals ($ resultString , $ this ->model ->formatUrlKey ($ strIn ));
140
140
}
141
141
142
+ /**
143
+ * @return void
144
+ */
145
+ public function testFormatUrlKeyWithoutTransliteration (): void
146
+ {
147
+ $ strIn = 'Some string ' ;
148
+ $ resultString = 'some-string ' ;
149
+
150
+ $ this ->scopeConfig ->expects ($ this ->once ())
151
+ ->method ('getValue ' )
152
+ ->with (
153
+ \Magento \Catalog \Helper \Product::XML_PATH_APPLY_TRANSLITERATION_TO_URL ,
154
+ \Magento \Store \Model \ScopeInterface::SCOPE_STORE
155
+ )->willReturn (false );
156
+ $ this ->assertEquals ($ resultString , $ this ->model ->formatUrlKey ($ strIn ));
157
+ }
158
+
142
159
/**
143
160
* @dataProvider getUrlDataProvider
144
161
* @covers \Magento\Catalog\Model\Product\Url::getUrl
You can’t perform that action at this time.
0 commit comments