@@ -68,9 +68,12 @@ public function testCheckSessionCookieWithGetCategoryList(): void
6868}
6969QUERY ;
7070 // Using cURL feature of flushing cookies upon completion of request
71- $ this ->graphQlClient ->getWithResponseHeaders ($ query , [], '' , [], true );
71+ $ result = $ this ->graphQlClient ->getWithResponseHeaders ($ query , [], '' , [], true );
72+ $ this ->assertEmpty ($ result ['cookies ' ]);
7273 // perform secondary request after cookies have been flushed
7374 $ result = $ this ->graphQlClient ->getWithResponseHeaders ($ query , [], '' , []);
75+
76+ // may have other cookies than session
7477 $ this ->assertNotEmpty ($ result ['cookies ' ]);
7578 $ this ->assertAnyCookieMatchesRegex ('/PHPSESSID=[a-z0-9]+;/ ' , $ result ['cookies ' ]);
7679 $ this ->assertCount (1 , $ result ['body ' ]['categoryList ' ]);
@@ -100,9 +103,12 @@ public function testCheckSessionCookieNotPresentWithGetCategoryList(): void
100103QUERY ;
101104 // CURL flushes cookies only upon completion of the request is the flag is set
102105 // perform graphql request with flushing cookies upon completion
103- $ this ->graphQlClient ->getWithResponseHeaders ($ query , [], '' , [], true );
106+ $ result = $ this ->graphQlClient ->getWithResponseHeaders ($ query , [], '' , [], true );
107+ $ this ->assertEmpty ($ result ['cookies ' ]);
108+
104109 // perform secondary request after cookies have been flushed
105110 $ result = $ this ->graphQlClient ->getWithResponseHeaders ($ query , [], '' , []);
111+
106112 // may have other cookies than session
107113 $ this ->assertNoCookiesMatchRegex ('/PHPSESSID=[a-z0-9]+;/ ' , $ result ['cookies ' ]);
108114 $ this ->assertCount (1 , $ result ['body ' ]['categoryList ' ]);
@@ -121,8 +127,14 @@ public function testSessionStartsInAddProductToCartMutation()
121127 $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_quote ' );
122128 $ query = $ this ->getQuery ($ maskedQuoteId , $ sku , $ quantity );
123129
124- $ this ->graphQlClient ->postWithResponseHeaders ($ query , [], '' , $ this ->getAuthHeaders (), true );
130+ $ result = $ this ->graphQlClient ->postWithResponseHeaders ($ query , [], '' , $ this ->getAuthHeaders (), true );
131+ // cookies are never empty and session is restarted for the authorized customer regardless current session
132+ $ this ->assertNotEmpty ($ result ['cookies ' ]);
133+ $ this ->assertAnyCookieMatchesRegex ('/PHPSESSID=[a-z0-9]+;/ ' , $ result ['cookies ' ]);
125134 $ result = $ this ->graphQlClient ->postWithResponseHeaders ($ query , [], '' , $ this ->getAuthHeaders ());
135+
136+ // cookies are never empty and session is restarted for the authorized customer
137+ // regardless current session and missing flush
126138 $ this ->assertNotEmpty ($ result ['cookies ' ]);
127139 $ this ->assertAnyCookieMatchesRegex ('/PHPSESSID=[a-z0-9]+;/ ' , $ result ['cookies ' ]);
128140 }
@@ -140,8 +152,11 @@ public function testSessionDoesNotStartInAddProductToCartMutation()
140152 $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_quote ' );
141153 $ query = $ this ->getQuery ($ maskedQuoteId , $ sku , $ quantity );
142154
143- $ this ->graphQlClient ->postWithResponseHeaders ($ query , [], '' , $ this ->getAuthHeaders (), true );
155+ $ result = $ this ->graphQlClient ->postWithResponseHeaders ($ query , [], '' , $ this ->getAuthHeaders (), true );
156+ // cookies may be empty or contain page cache private content version
157+ $ this ->assertNoCookiesMatchRegex ('/PHPSESSID=[a-z0-9]+;/ ' , $ result ['cookies ' ]);
144158 $ result = $ this ->graphQlClient ->postWithResponseHeaders ($ query , [], '' , $ this ->getAuthHeaders ());
159+ // cookies may be empty or contain page cache private content version
145160 $ this ->assertNoCookiesMatchRegex ('/PHPSESSID=[a-z0-9]+;/ ' , $ result ['cookies ' ]);
146161 }
147162
0 commit comments