File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed
app/code/Magento/PageCache/Test/Unit/Model/App/Request/Http
lib/internal/Magento/Framework/App/Test/Unit/PageCache Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -121,4 +121,43 @@ function ($value) {
121
121
$ this ->model ->getValue ()
122
122
);
123
123
}
124
+
125
+ /**
126
+ * Test get identifier for save value with marketing parameters.
127
+ *
128
+ * @return void
129
+ */
130
+ public function testGetValueWithMarketingParameters (): void
131
+ {
132
+ $ this ->requestMock ->expects ($ this ->any ())
133
+ ->method ('isSecure ' )
134
+ ->willReturn (true );
135
+
136
+ $ this ->requestMock ->expects ($ this ->any ())
137
+ ->method ('getUriString ' )
138
+ ->willReturn ('http://example.com/path1/?abc=123&gclid=456&utm_source=abc ' );
139
+
140
+ $ this ->contextMock ->expects ($ this ->any ())
141
+ ->method ('getVaryString ' )
142
+ ->willReturn (self ::VARY );
143
+
144
+ $ this ->identifierStoreReader ->method ('getPageTagsWithStoreCacheTags ' )->willReturnCallback (
145
+ function ($ value ) {
146
+ return $ value ;
147
+ }
148
+ );
149
+
150
+ $ this ->assertEquals (
151
+ sha1 (
152
+ json_encode (
153
+ [
154
+ true ,
155
+ 'http://example.com/path1/?abc=123 ' ,
156
+ self ::VARY
157
+ ]
158
+ )
159
+ ),
160
+ $ this ->model ->getValue ()
161
+ );
162
+ }
124
163
}
Original file line number Diff line number Diff line change @@ -186,4 +186,37 @@ public function testGetValue(): void
186
186
$ this ->model ->getValue ()
187
187
);
188
188
}
189
+
190
+ /**
191
+ * Test get identifier value with marketing parameters.
192
+ *
193
+ * @return void
194
+ */
195
+ public function testGetValueWithMarketingParameters (): void
196
+ {
197
+ $ this ->requestMock ->expects ($ this ->any ())
198
+ ->method ('isSecure ' )
199
+ ->willReturn (true );
200
+
201
+ $ this ->requestMock ->expects ($ this ->any ())
202
+ ->method ('getUriString ' )
203
+ ->willReturn ('http://example.com/path1/?abc=123&gclid=456&utm_source=abc ' );
204
+
205
+ $ this ->contextMock ->expects ($ this ->any ())
206
+ ->method ('getVaryString ' )
207
+ ->willReturn (self ::VARY );
208
+
209
+ $ this ->assertEquals (
210
+ sha1 (
211
+ json_encode (
212
+ [
213
+ true ,
214
+ 'http://example.com/path1/?abc=123 ' ,
215
+ self ::VARY
216
+ ]
217
+ )
218
+ ),
219
+ $ this ->model ->getValue ()
220
+ );
221
+ }
189
222
}
You can’t perform that action at this time.
0 commit comments