@@ -43,7 +43,7 @@ public function testCacheResultForGuest()
43
43
}
44
44
45
45
/**
46
- * Test that changing the STORE header returns different cache results.
46
+ * Test that changing the Store header returns different cache results.
47
47
*
48
48
* @magentoConfigFixture default/system/full_page_cache/caching_application 2
49
49
* @magentoApiDataFixture Magento/Store/_files/second_store.php
@@ -54,22 +54,22 @@ public function testCacheResultForGuestWithStoreHeader()
54
54
$ productSku = 'simple2 ' ;
55
55
$ query = $ this ->getProductQuery ($ productSku );
56
56
57
- // Verify caching works as expected without a STORE header
57
+ // Verify caching works as expected without a Store header
58
58
$ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
59
59
$ this ->assertArrayHasKey (CacheIdCalculator::CACHE_ID_HEADER , $ response ['headers ' ]);
60
60
$ defaultStoreCacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
61
61
$ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
62
62
$ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
63
63
64
- // Obtain a new X-Magento-Cache-Id using after updating the STORE header
64
+ // Obtain a new X-Magento-Cache-Id using after updating the Store header
65
65
$ secondStoreResponse = $ this ->graphQlQueryWithResponseHeaders (
66
66
$ query ,
67
67
[],
68
68
'' ,
69
69
[
70
- CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ,
71
- 'Store ' => 'fixture_second_store '
72
- ]
70
+ CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ,
71
+ 'Store ' => 'fixture_second_store '
72
+ ]
73
73
);
74
74
$ secondStoreCacheId = $ secondStoreResponse ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
75
75
@@ -79,7 +79,7 @@ public function testCacheResultForGuestWithStoreHeader()
79
79
'Store ' => 'fixture_second_store '
80
80
]);
81
81
82
- // Verify we obtain a cache HIT the second time around with the STORE header
82
+ // Verify we obtain a cache HIT the second time around with the Store header
83
83
$ this ->assertCacheHit ($ query , [
84
84
CacheIdCalculator::CACHE_ID_HEADER => $ secondStoreCacheId ,
85
85
'Store ' => 'fixture_second_store '
@@ -90,6 +90,8 @@ public function testCacheResultForGuestWithStoreHeader()
90
90
}
91
91
92
92
/**
93
+ * Test that changing the Content-Currency header returns different cache results.
94
+ *
93
95
* @magentoConfigFixture default/system/full_page_cache/caching_application 2
94
96
* @magentoApiDataFixture Magento/Store/_files/multiple_currencies.php
95
97
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
@@ -99,38 +101,38 @@ public function testCacheResultForGuestWithCurrencyHeader()
99
101
$ productSku = 'simple_product ' ;
100
102
$ query = $ this ->getProductQuery ($ productSku );
101
103
102
- // Verify caching works as expected without a currency header
104
+ // Verify caching works as expected without a Content-Currency header
103
105
$ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
104
106
$ this ->assertArrayHasKey (CacheIdCalculator::CACHE_ID_HEADER , $ response ['headers ' ]);
105
107
$ defaultCurrencyCacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
106
108
$ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
107
109
$ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
108
110
109
- // Obtain a new X-Magento-Cache-Id using after updating the CONTENT-CURRENCY header
111
+ // Obtain a new X-Magento-Cache-Id using after updating the Content-Currency header
110
112
$ secondCurrencyResponse = $ this ->graphQlQueryWithResponseHeaders (
111
113
$ query ,
112
114
[],
113
115
'' ,
114
116
[
115
- CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ,
116
- ' content-currency ' => 'EUR '
117
- ]
117
+ CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ,
118
+ ' Content-Currency ' => 'EUR '
119
+ ]
118
120
);
119
121
$ secondCurrencyCacheId = $ secondCurrencyResponse ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
120
122
121
123
// Verify we obtain a cache MISS the first time we search by this X-Magento-Cache-Id
122
124
$ this ->assertCacheMiss ($ query , [
123
125
CacheIdCalculator::CACHE_ID_HEADER => $ secondCurrencyCacheId ,
124
- 'content-currency ' => 'EUR '
126
+ 'Content-Currency ' => 'EUR '
125
127
]);
126
128
127
129
// Verify we obtain a cache HIT the second time around with the changed currency header
128
130
$ this ->assertCacheHit ($ query , [
129
131
CacheIdCalculator::CACHE_ID_HEADER => $ secondCurrencyCacheId ,
130
- 'content-currency ' => 'EUR '
132
+ 'Content-Currency ' => 'EUR '
131
133
]);
132
134
133
- // Verify we still obtain a cache HIT for the default currency ( no content-currency header)
135
+ // Verify we still obtain a cache HIT for the default currency ( no Content-Currency header)
134
136
$ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
135
137
}
136
138
@@ -153,40 +155,34 @@ public function testCacheResultForGuestWithOutdatedCacheId()
153
155
$ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ]);
154
156
$ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ]);
155
157
156
- // Obtain a new X-Magento-Cache-Id using after updating the request with STORE header
158
+ // Obtain a new X-Magento-Cache-Id using after updating the request with Store header
157
159
$ responseWithStore = $ this ->graphQlQueryWithResponseHeaders (
158
160
$ query ,
159
161
[],
160
162
'' ,
161
163
[
162
164
CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ,
163
- 'STORE ' => 'fixture_second_store '
165
+ 'Store ' => 'fixture_second_store '
164
166
]
165
167
);
166
168
$ storeCacheId = $ responseWithStore ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
167
169
168
- // Verify we obtain a cache MISS since we use the old cache id
170
+ // Verify we still get a cache MISS since the cache id in the request doesn't match the cache id from response
169
171
$ this ->assertCacheMiss ($ query , [
170
172
CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ,
171
- 'STORE ' => 'fixture_second_store '
172
- ]);
173
-
174
- // Verify we obtain cache MISS again since the cache id in the request doesn't match the cache id from response
175
- $ this ->assertCacheMiss ($ query , [
176
- CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ,
177
- 'STORE ' => 'fixture_second_store '
173
+ 'Store ' => 'fixture_second_store '
178
174
]);
179
175
180
176
// Verify we get a cache MISS first time with the updated cache id
181
177
$ this ->assertCacheMiss ($ query , [
182
178
CacheIdCalculator::CACHE_ID_HEADER => $ storeCacheId ,
183
- 'STORE ' => 'fixture_second_store '
179
+ 'Store ' => 'fixture_second_store '
184
180
]);
185
181
186
- // Verify we obtain a cache HIT second time around with the updated cache id
182
+ // Verify we obtain a cache HIT second time around with the updated cache id
187
183
$ this ->assertCacheHit ($ query , [
188
184
CacheIdCalculator::CACHE_ID_HEADER => $ storeCacheId ,
189
- 'STORE ' => 'fixture_second_store '
185
+ 'Store ' => 'fixture_second_store '
190
186
]);
191
187
}
192
188
0 commit comments