1111use Magento \Catalog \Model \Product ;
1212use Magento \Catalog \Model \Product \Url ;
1313use Magento \Catalog \Model \Product \Url as ProductUrl ;
14+ use Magento \Framework \App \Config \ScopeConfigInterface ;
1415use Magento \Framework \Filter \FilterManager ;
1516use Magento \Framework \Session \SidResolverInterface ;
1617use 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