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)
119119 \Magento \Store \Model \ScopeInterface::SCOPE_STORE
120120 )) {
121121 return $ this ->filter ->translitUrl ($ str );
122+ } else {
123+ $ str = preg_replace ('/\s+/ ' , '- ' , $ str );
124+ $ str = mb_strtolower ($ str );
125+ $ str = trim ($ str , '- ' );
122126 }
123127
124128 return $ str ;
Original file line number Diff line number Diff line change @@ -139,6 +139,23 @@ public function testFormatUrlKey(): void
139139 $ this ->assertEquals ($ resultString , $ this ->model ->formatUrlKey ($ strIn ));
140140 }
141141
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+
142159 /**
143160 * @dataProvider getUrlDataProvider
144161 * @covers \Magento\Catalog\Model\Product\Url::getUrl
You can’t perform that action at this time.
0 commit comments