@@ -43,7 +43,7 @@ public function testCacheResultForGuest()
4343 }
4444
4545 /**
46- * Test that changing the STORE header returns different cache results.
46+ * Test that changing the Store header returns different cache results.
4747 *
4848 * @magentoConfigFixture default/system/full_page_cache/caching_application 2
4949 * @magentoApiDataFixture Magento/Store/_files/second_store.php
@@ -54,22 +54,22 @@ public function testCacheResultForGuestWithStoreHeader()
5454 $ productSku = 'simple2 ' ;
5555 $ query = $ this ->getProductQuery ($ productSku );
5656
57- // Verify caching works as expected without a STORE header
57+ // Verify caching works as expected without a Store header
5858 $ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
5959 $ this ->assertArrayHasKey (CacheIdCalculator::CACHE_ID_HEADER , $ response ['headers ' ]);
6060 $ defaultStoreCacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
6161 $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
6262 $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
6363
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
6565 $ secondStoreResponse = $ this ->graphQlQueryWithResponseHeaders (
6666 $ query ,
6767 [],
6868 '' ,
6969 [
70- CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ,
71- 'Store ' => 'fixture_second_store '
72- ]
70+ CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ,
71+ 'Store ' => 'fixture_second_store '
72+ ]
7373 );
7474 $ secondStoreCacheId = $ secondStoreResponse ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
7575
@@ -79,7 +79,7 @@ public function testCacheResultForGuestWithStoreHeader()
7979 'Store ' => 'fixture_second_store '
8080 ]);
8181
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
8383 $ this ->assertCacheHit ($ query , [
8484 CacheIdCalculator::CACHE_ID_HEADER => $ secondStoreCacheId ,
8585 'Store ' => 'fixture_second_store '
@@ -90,6 +90,8 @@ public function testCacheResultForGuestWithStoreHeader()
9090 }
9191
9292 /**
93+ * Test that changing the Content-Currency header returns different cache results.
94+ *
9395 * @magentoConfigFixture default/system/full_page_cache/caching_application 2
9496 * @magentoApiDataFixture Magento/Store/_files/multiple_currencies.php
9597 * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
@@ -99,38 +101,38 @@ public function testCacheResultForGuestWithCurrencyHeader()
99101 $ productSku = 'simple_product ' ;
100102 $ query = $ this ->getProductQuery ($ productSku );
101103
102- // Verify caching works as expected without a currency header
104+ // Verify caching works as expected without a Content-Currency header
103105 $ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
104106 $ this ->assertArrayHasKey (CacheIdCalculator::CACHE_ID_HEADER , $ response ['headers ' ]);
105107 $ defaultCurrencyCacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
106108 $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
107109 $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
108110
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
110112 $ secondCurrencyResponse = $ this ->graphQlQueryWithResponseHeaders (
111113 $ query ,
112114 [],
113115 '' ,
114116 [
115- CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ,
116- ' content-currency ' => 'EUR '
117- ]
117+ CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ,
118+ ' Content-Currency ' => 'EUR '
119+ ]
118120 );
119121 $ secondCurrencyCacheId = $ secondCurrencyResponse ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
120122
121123 // Verify we obtain a cache MISS the first time we search by this X-Magento-Cache-Id
122124 $ this ->assertCacheMiss ($ query , [
123125 CacheIdCalculator::CACHE_ID_HEADER => $ secondCurrencyCacheId ,
124- 'content-currency ' => 'EUR '
126+ 'Content-Currency ' => 'EUR '
125127 ]);
126128
127129 // Verify we obtain a cache HIT the second time around with the changed currency header
128130 $ this ->assertCacheHit ($ query , [
129131 CacheIdCalculator::CACHE_ID_HEADER => $ secondCurrencyCacheId ,
130- 'content-currency ' => 'EUR '
132+ 'Content-Currency ' => 'EUR '
131133 ]);
132134
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)
134136 $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
135137 }
136138
@@ -153,40 +155,34 @@ public function testCacheResultForGuestWithOutdatedCacheId()
153155 $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ]);
154156 $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ]);
155157
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
157159 $ responseWithStore = $ this ->graphQlQueryWithResponseHeaders (
158160 $ query ,
159161 [],
160162 '' ,
161163 [
162164 CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ,
163- 'STORE ' => 'fixture_second_store '
165+ 'Store ' => 'fixture_second_store '
164166 ]
165167 );
166168 $ storeCacheId = $ responseWithStore ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
167169
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
169171 $ this ->assertCacheMiss ($ query , [
170172 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 '
178174 ]);
179175
180176 // Verify we get a cache MISS first time with the updated cache id
181177 $ this ->assertCacheMiss ($ query , [
182178 CacheIdCalculator::CACHE_ID_HEADER => $ storeCacheId ,
183- 'STORE ' => 'fixture_second_store '
179+ 'Store ' => 'fixture_second_store '
184180 ]);
185181
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
187183 $ this ->assertCacheHit ($ query , [
188184 CacheIdCalculator::CACHE_ID_HEADER => $ storeCacheId ,
189- 'STORE ' => 'fixture_second_store '
185+ 'Store ' => 'fixture_second_store '
190186 ]);
191187 }
192188
0 commit comments