@@ -35,17 +35,17 @@ class ContextNonDefaultStoreDirectLinkTest extends TestCase
35
35
* Test for full page cache hits from new http clients if store context was specified in the URL
36
36
*
37
37
* @dataProvider cacheHitOnDirectLinkToNonDefaultStoreView
38
- * @param $customStore
39
- * @param $defaultStore
40
- * @param $setValueNumberOfTimes
41
- * @param $xmlPathStoreInUrl
38
+ * @param string $customStore
39
+ * @param string $defaultStore
40
+ * @param string $expectedDefaultStore
41
+ * @param bool $useStoreInUrl
42
42
* @return void
43
43
*/
44
44
public function testCacheHitOnDirectLinkToNonDefaultStoreView (
45
- $ customStore ,
46
- $ defaultStore ,
47
- $ setValueNumberOfTimes ,
48
- $ xmlPathStoreInUrl
45
+ string $ customStore ,
46
+ string $ defaultStore ,
47
+ string $ expectedDefaultStore ,
48
+ bool $ useStoreInUrl
49
49
) {
50
50
$ sessionMock = $ this ->createPartialMock (Generic::class, ['getCurrencyCode ' ]);
51
51
$ httpContextMock = $ this ->createMock (HttpContext::class);
@@ -89,14 +89,12 @@ public function testCacheHitOnDirectLinkToNonDefaultStoreView(
89
89
->method ('getDefaultCurrencyCode ' )
90
90
->willReturn (self ::CURRENCY_CURRENT_STORE );
91
91
92
- $ currentStoreMock ->expects ($ this ->any ())
93
- ->method ('getConfig ' )
94
- ->willReturn ($ xmlPathStoreInUrl );
95
-
96
92
$ currentStoreMock ->expects ($ this ->any ())
97
93
->method ('getCode ' )
98
94
->willReturn ($ customStore );
99
95
96
+ $ currentStoreMock ->method ('isUseStoreInUrl ' )->willReturn ($ useStoreInUrl );
97
+
100
98
$ storeManager ->expects ($ this ->any ())
101
99
->method ('getWebsite ' )
102
100
->willReturn ($ websiteMock );
@@ -126,8 +124,11 @@ public function testCacheHitOnDirectLinkToNonDefaultStoreView(
126
124
->method ('getCurrencyCode ' )
127
125
->willReturn (self ::CURRENCY_SESSION );
128
126
129
- $ httpContextMock ->expects ($ this ->exactly ($ setValueNumberOfTimes ))
130
- ->method ('setValue ' );
127
+ $ httpContextMock ->expects ($ this ->at (1 ))->method (
128
+ 'setValue '
129
+ )->with (StoreManagerInterface::CONTEXT_STORE , $ customStore , $ expectedDefaultStore );
130
+
131
+ $ httpContextMock ->expects ($ this ->at (2 ))->method ('setValue ' );
131
132
132
133
$ plugin ->beforeDispatch (
133
134
$ subjectMock ,
@@ -141,20 +142,20 @@ public function cacheHitOnDirectLinkToNonDefaultStoreView()
141
142
[
142
143
'custom_store ' ,
143
144
'default ' ,
144
- 1 ,
145
- 1
145
+ ' custom_store ' ,
146
+ true ,
146
147
],
147
148
[
149
+ 'custom_store ' ,
148
150
'default ' ,
149
151
'default ' ,
150
- 2 ,
151
- 0
152
+ false ,
152
153
],
153
154
[
154
155
'default ' ,
155
156
'default ' ,
156
- 2 ,
157
- 1
157
+ ' default ' ,
158
+ true ,
158
159
],
159
160
];
160
161
}
0 commit comments