@@ -45,9 +45,10 @@ public function testCacheIsUsedOnSecondRequest()
4545
4646 $ query = $ this ->getPageQuery ($ pageId );
4747
48- // Obtain the X-Magento-Cache-Id from the response which will be used as the cache key
48+
4949 $ response = $ this ->graphQlQueryWithResponseHeaders ($ query );
5050 $ this ->assertArrayHasKey (CacheIdCalculator::CACHE_ID_HEADER , $ response ['headers ' ]);
51+ // Obtain the X-Magento-Cache-Id from the response which will be used as the cache key
5152 $ cacheId = $ response ['headers ' ][CacheIdCalculator::CACHE_ID_HEADER ];
5253 // Verify we obtain a cache MISS the first time
5354 $ this ->assertCacheMissAndReturnResponse ($ query , [CacheIdCalculator::CACHE_ID_HEADER => $ cacheId ]);
@@ -101,37 +102,44 @@ public function testCacheIsInvalidatedOnPageUpdate()
101102 [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdPageBlankResponse ]
102103 );
103104
104- //cache-debug should be a HIT on second request
105+ //cache-debug should be a HIT on second request for page100 query
105106 $ this ->assertCacheHitAndReturnResponse (
106107 $ page100Query ,
107108 [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdPage100Response ]
108109 );
109- //cache-debug should be a HIT on second request
110+ //cache-debug should be a HIT on second request for page blank query
110111 $ this ->assertCacheHitAndReturnResponse (
111112 $ pageBlankQuery ,
112113 [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdPageBlankResponse ]
113114 );
114115
116+ //cache-debug should be a MISS after updating the blank page
115117 $ pageRepository = Bootstrap::getObjectManager ()->get (PageRepository::class);
116118 $ newPageContent = 'New page content for blank page. ' ;
117119 $ pageBlank ->setContent ($ newPageContent );
118120 $ pageRepository ->save ($ pageBlank );
119121
120- //cache-debug should be a MISS after updating the page
122+
121123 $ pageBlankResponseMissAfterUpdate = $ this ->graphQlQueryWithResponseHeaders ($ pageBlankQuery );
122- // Verify we obtain a cache MISS after updating the page
124+ // Verify we obtain a cache MISS after updating the page blank query
123125 $ this ->assertCacheMissAndReturnResponse (
124126 $ pageBlankQuery ,
125127 [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdPageBlankResponse ]
126128 );
127129
130+ $ pageBlankResponseHitAfterUpdate = $ this ->assertCacheHitAndReturnResponse (
131+ $ pageBlankQuery ,
132+ [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdPageBlankResponse ]
133+ );
134+
135+ // Verify we obtain a cache Hit after updating the page on page 100 query
128136 $ this ->assertCacheHitAndReturnResponse (
129137 $ page100Query ,
130138 [CacheIdCalculator::CACHE_ID_HEADER => $ cacheIdPage100Response ]
131139 );
132140
133- //updated page data should be correct
134- $ this ->assertNotEmpty ($ pageBlankResponseMissAfterUpdate ['body ' ]);
141+ //updated page data should be correct for blank page
142+ $ this ->assertNotEmpty ($ pageBlankResponseHitAfterUpdate ['body ' ]);
135143 $ pageData = $ pageBlankResponseMissAfterUpdate ['body ' ]['cmsPage ' ];
136144 $ this ->assertArrayNotHasKey ('errors ' , $ pageBlankResponseMissAfterUpdate ['body ' ]);
137145 $ this ->assertEquals ('Cms Page Design Blank ' , $ pageData ['title ' ]);
0 commit comments