11
11
use Magento \Catalog \Model \Product ;
12
12
use Magento \Catalog \Model \Product \Url ;
13
13
use Magento \Catalog \Model \Product \Url as ProductUrl ;
14
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
14
15
use Magento \Framework \Filter \FilterManager ;
15
16
use Magento \Framework \Session \SidResolverInterface ;
16
17
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
@@ -53,6 +54,11 @@ class UrlTest extends TestCase
53
54
*/
54
55
protected $ sidResolver ;
55
56
57
+ /**
58
+ * @var ScopeConfigInterface
59
+ */
60
+ private ScopeConfigInterface $ scopeConfig ;
61
+
56
62
protected function setUp (): void
57
63
{
58
64
$ this ->filter = $ this ->getMockBuilder (
@@ -87,6 +93,8 @@ protected function setUp(): void
87
93
$ urlFactory ->method ('create ' )
88
94
->willReturn ($ this ->url );
89
95
96
+ $ this ->scopeConfig = $ this ->createMock (ScopeConfigInterface::class);
97
+
90
98
$ objectManager = new ObjectManager ($ this );
91
99
$ this ->model = $ objectManager ->getObject (
92
100
ProductUrl::class,
@@ -96,11 +104,15 @@ protected function setUp(): void
96
104
'storeManager ' => $ storeManager ,
97
105
'urlFactory ' => $ urlFactory ,
98
106
'sidResolver ' => $ this ->sidResolver ,
107
+ 'scopeConfig ' => $ this ->scopeConfig
99
108
]
100
109
);
101
110
}
102
111
103
- public function testFormatUrlKey ()
112
+ /**
113
+ * @return void
114
+ */
115
+ public function testFormatUrlKey (): void
104
116
{
105
117
$ strIn = 'Some string ' ;
106
118
$ resultString = 'some ' ;
@@ -115,6 +127,12 @@ public function testFormatUrlKey()
115
127
$ resultString
116
128
);
117
129
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 );
118
136
$ this ->assertEquals ($ resultString , $ this ->model ->formatUrlKey ($ strIn ));
119
137
}
120
138
0 commit comments