@@ -31,10 +31,10 @@ public function testCacheResultForGuest()
31
31
$ cacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
32
32
33
33
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
34
- $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheId ]);
34
+ $ this ->assertCacheMissAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheId ]);
35
35
36
36
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
37
- $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheId ]);
37
+ $ this ->assertCacheHitAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheId ]);
38
38
}
39
39
40
40
/**
@@ -55,9 +55,9 @@ public function testCacheResultForGuestWithStoreHeader()
55
55
$ defaultStoreCacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
56
56
57
57
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
58
- $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
58
+ $ this ->assertCacheMissAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
59
59
// Verify we obtain a cache HIT the second time we search the cache using this X-Magento-Cache-Id
60
- $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
60
+ $ this ->assertCacheHitAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
61
61
62
62
// Obtain a new X-Magento-Cache-Id using after updating the Store header
63
63
$ secondStoreResponse = $ this ->graphQlQueryWithResponseHeaders (
@@ -72,19 +72,19 @@ public function testCacheResultForGuestWithStoreHeader()
72
72
$ secondStoreCacheId = $ secondStoreResponse ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
73
73
74
74
// Verify we obtain a cache MISS the first time we search by this X-Magento-Cache-Id
75
- $ this ->assertCacheMiss ($ query , [
75
+ $ this ->assertCacheMissAndReturnResponse ($ query , [
76
76
CacheIdCalculator::CACHE_ID_HEADER => $ secondStoreCacheId ,
77
77
'Store ' => 'fixture_second_store '
78
78
]);
79
79
80
80
// Verify we obtain a cache HIT the second time around with the Store header
81
- $ this ->assertCacheHit ($ query , [
81
+ $ this ->assertCacheHitAndReturnResponse ($ query , [
82
82
CacheIdCalculator::CACHE_ID_HEADER => $ secondStoreCacheId ,
83
83
'Store ' => 'fixture_second_store '
84
84
]);
85
85
86
86
// Verify we still obtain a cache HIT for the default store
87
- $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
87
+ $ this ->assertCacheHitAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultStoreCacheId ]);
88
88
}
89
89
90
90
/**
@@ -105,9 +105,9 @@ public function testCacheResultForGuestWithCurrencyHeader()
105
105
$ defaultCurrencyCacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
106
106
107
107
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
108
- $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
108
+ $ this ->assertCacheMissAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
109
109
// Verify we obtain a cache HIT the second time we search the cache using this X-Magento-Cache-Id
110
- $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
110
+ $ this ->assertCacheHitAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
111
111
112
112
// Obtain a new X-Magento-Cache-Id using after updating the Content-Currency header
113
113
$ secondCurrencyResponse = $ this ->graphQlQueryWithResponseHeaders (
@@ -122,19 +122,19 @@ public function testCacheResultForGuestWithCurrencyHeader()
122
122
$ secondCurrencyCacheId = $ secondCurrencyResponse ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
123
123
124
124
// Verify we obtain a cache MISS the first time we search by this X-Magento-Cache-Id
125
- $ this ->assertCacheMiss ($ query , [
125
+ $ this ->assertCacheMissAndReturnResponse ($ query , [
126
126
CacheIdCalculator::CACHE_ID_HEADER => $ secondCurrencyCacheId ,
127
127
'Content-Currency ' => 'EUR '
128
128
]);
129
129
130
130
// Verify we obtain a cache HIT the second time around with the changed currency header
131
- $ this ->assertCacheHit ($ query , [
131
+ $ this ->assertCacheHitAndReturnResponse ($ query , [
132
132
CacheIdCalculator::CACHE_ID_HEADER => $ secondCurrencyCacheId ,
133
133
'Content-Currency ' => 'EUR '
134
134
]);
135
135
136
136
// Verify we still obtain a cache HIT for the default currency ( no Content-Currency header)
137
- $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
137
+ $ this ->assertCacheHitAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCurrencyCacheId ]);
138
138
}
139
139
140
140
/**
@@ -153,8 +153,8 @@ public function testCacheResultForGuestWithOutdatedCacheId()
153
153
$ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
154
154
$ this ->assertArrayHasKey (CacheIdCalculator::CACHE_ID_HEADER , $ response ['headers ' ]);
155
155
$ defaultCacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
156
- $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ]);
157
- $ this ->assertCacheHit ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ]);
156
+ $ this ->assertCacheMissAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ]);
157
+ $ this ->assertCacheHitAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ]);
158
158
159
159
// Obtain a new X-Magento-Cache-Id using after updating the request with Store header
160
160
$ responseWithStore = $ this ->graphQlQueryWithResponseHeaders (
@@ -169,19 +169,19 @@ public function testCacheResultForGuestWithOutdatedCacheId()
169
169
$ storeCacheId = $ responseWithStore ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
170
170
171
171
// Verify we still get a cache MISS since the cache id in the request doesn't match the cache id from response
172
- $ this ->assertCacheMiss ($ query , [
172
+ $ this ->assertCacheMissAndReturnResponse ($ query , [
173
173
CacheIdCalculator::CACHE_ID_HEADER => $ defaultCacheId ,
174
174
'Store ' => 'fixture_second_store '
175
175
]);
176
176
177
177
// Verify we get a cache MISS first time with the updated cache id
178
- $ this ->assertCacheMiss ($ query , [
178
+ $ this ->assertCacheMissAndReturnResponse ($ query , [
179
179
CacheIdCalculator::CACHE_ID_HEADER => $ storeCacheId ,
180
180
'Store ' => 'fixture_second_store '
181
181
]);
182
182
183
183
// Verify we obtain a cache HIT second time around with the updated cache id
184
- $ this ->assertCacheHit ($ query , [
184
+ $ this ->assertCacheHitAndReturnResponse ($ query , [
185
185
CacheIdCalculator::CACHE_ID_HEADER => $ storeCacheId ,
186
186
'Store ' => 'fixture_second_store '
187
187
]);
@@ -210,13 +210,13 @@ public function testCacheResultForCustomer()
210
210
$ customerToken = $ tokenResponse ['body ' ]['generateCustomerToken ' ]['token ' ];
211
211
212
212
// Verify we obtain cache MISS the first time we search by this X-Magento-Cache-Id
213
- $ this ->assertCacheMiss ($ query , [
213
+ $ this ->assertCacheMissAndReturnResponse ($ query , [
214
214
CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdCustomer ,
215
215
'Authorization ' => 'Bearer ' . $ customerToken
216
216
]);
217
217
218
218
// Verify we obtain cache HIT second time using the same X-Magento-Cache-Id
219
- $ this ->assertCacheHit ($ query , [
219
+ $ this ->assertCacheHitAndReturnResponse ($ query , [
220
220
CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdCustomer ,
221
221
'Authorization ' => 'Bearer ' . $ customerToken
222
222
]);
@@ -237,8 +237,8 @@ public function testCacheResultForCustomer()
237
237
$ this ->assertNotEquals ($ cacheIdCustomer , $ cacheIdGuest );
238
238
239
239
//Verify that omitting the Auth token doesn't send cached content for a logged-in customer
240
- $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdCustomer ]);
241
- $ this ->assertCacheMiss ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdCustomer ]);
240
+ $ this ->assertCacheMissAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdCustomer ]);
241
+ $ this ->assertCacheMissAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdCustomer ]);
242
242
}
243
243
244
244
/**
0 commit comments