@@ -135,7 +135,7 @@ public function testFiltersDisabledEntirelyProducesDifferentCacheKey(): void
135135 $ this ->assertNotEquals ($ hashEnabled , $ hashDisabled );
136136 }
137137
138- public function testListCacheKeyUsesListCacheShape (): void
138+ public function testQueryCacheKeyUsesQueryCacheShape (): void
139139 {
140140 $ adapter = $ this ->createMock (Adapter::class);
141141 $ adapter ->method ('getSupportForHostname ' )->willReturn (true );
@@ -146,12 +146,12 @@ public function testListCacheKeyUsesListCacheShape(): void
146146 $ db = new Database ($ adapter , new Cache (new None ()), []);
147147
148148 $ this ->assertSame (
149- 'default-cache-mysql-console:_39::collection:ttl_cache_table:list ' ,
150- $ db ->getListCacheKey ('ttl_cache_table ' ),
149+ 'default-cache-mysql-console:_39::collection:ttl_cache_table:query ' ,
150+ $ db ->getQueryCacheKey ('ttl_cache_table ' ),
151151 );
152152 }
153153
154- public function testListCacheKeyCanOverrideNamespaceSegment (): void
154+ public function testQueryCacheKeyCanOverrideNamespaceSegment (): void
155155 {
156156 $ adapter = $ this ->createMock (Adapter::class);
157157 $ adapter ->method ('getSupportForHostname ' )->willReturn (true );
@@ -162,12 +162,12 @@ public function testListCacheKeyCanOverrideNamespaceSegment(): void
162162 $ db = new Database ($ adapter , new Cache (new None ()), []);
163163
164164 $ this ->assertSame (
165- 'default-cache-mysql-console:_39::collection:wafrules:list ' ,
166- $ db ->getListCacheKey ('wafrules ' , '_39 ' ),
165+ 'default-cache-mysql-console:_39::collection:wafrules:query ' ,
166+ $ db ->getQueryCacheKey ('wafrules ' , '_39 ' ),
167167 );
168168 }
169169
170- public function testListCacheFieldUsesListCacheShape (): void
170+ public function testQueryCacheFieldUsesQueryCacheShape (): void
171171 {
172172 $ db = $ this ->createDatabase ();
173173 $ collection = new Document ([
@@ -192,18 +192,18 @@ public function testListCacheFieldUsesListCacheShape(): void
192192 . (\json_encode ($ collection ->getAttribute ('$permissions ' , [])) ?: '' )
193193 . (\json_encode ($ collection ->getAttribute ('documentSecurity ' , false )) ?: '' )
194194 );
195- $ field = $ db ->getListCacheField ($ collection , $ queries );
195+ $ field = $ db ->getQueryCacheField ($ collection , $ queries );
196196
197197 $ this ->assertStringStartsWith ("{$ schemaHash }: " , $ field );
198198 $ this ->assertStringEndsWith (':documents ' , $ field );
199199 $ this ->assertSame (2 , \substr_count ($ field , ': ' ));
200200 }
201201
202- public function testListCacheFieldChangesWithInputs (): void
202+ public function testQueryCacheFieldChangesWithInputs (): void
203203 {
204204 $ db = $ this ->createDatabase ();
205205
206- $ field = $ db ->getListCacheField (
206+ $ field = $ db ->getQueryCacheField (
207207 new Document ([
208208 'attributes ' => [new Document (['$id ' => 'name ' , 'type ' => Database::VAR_STRING ])],
209209 'indexes ' => [],
@@ -213,50 +213,50 @@ public function testListCacheFieldChangesWithInputs(): void
213213
214214 $ this ->assertNotSame (
215215 $ field ,
216- $ db ->getListCacheField (
216+ $ db ->getQueryCacheField (
217217 new Document ([
218218 'attributes ' => [new Document (['$id ' => 'status ' , 'type ' => Database::VAR_STRING ])],
219219 'indexes ' => [],
220220 ]),
221221 [Query ::limit (10 )],
222222 ),
223223 );
224- $ this ->assertNotSame ($ field , $ db ->getListCacheField (null , [Query ::limit (20 )]));
225- $ this ->assertNotSame ($ field , $ db ->getListCacheField (null , [Query ::limit (10 )], forPermission: Database::PERMISSION_UPDATE ));
226- $ this ->assertStringEndsWith (':total ' , $ db ->getListCacheField (null , [Query ::limit (10 )], 'total ' ));
224+ $ this ->assertNotSame ($ field , $ db ->getQueryCacheField (null , [Query ::limit (20 )]));
225+ $ this ->assertNotSame ($ field , $ db ->getQueryCacheField (null , [Query ::limit (10 )], forPermission: Database::PERMISSION_UPDATE ));
226+ $ this ->assertStringEndsWith (':total ' , $ db ->getQueryCacheField (null , [Query ::limit (10 )], 'total ' ));
227227 }
228228
229- public function testListCacheFieldChangesWithActiveAuthorizationContext (): void
229+ public function testQueryCacheFieldChangesWithActiveAuthorizationContext (): void
230230 {
231231 $ db = $ this ->createDatabase ();
232232
233- $ field = $ db ->getListCacheField (null , [Query ::limit (10 )]);
233+ $ field = $ db ->getQueryCacheField (null , [Query ::limit (10 )]);
234234
235235 $ this ->assertNotSame (
236236 $ field ,
237- $ db ->getAuthorization ()->skip (fn () => $ db ->getListCacheField (null , [Query ::limit (10 )])),
237+ $ db ->getAuthorization ()->skip (fn () => $ db ->getQueryCacheField (null , [Query ::limit (10 )])),
238238 );
239239
240240 $ db ->getAuthorization ()->addRole ('user:1 ' );
241241
242242 $ this ->assertNotSame (
243243 $ field ,
244- $ db ->getListCacheField (null , [Query ::limit (10 )]),
244+ $ db ->getQueryCacheField (null , [Query ::limit (10 )]),
245245 );
246246 }
247247
248- public function testListCacheFieldIncludesCursorDocumentPayload (): void
248+ public function testQueryCacheFieldIncludesCursorDocumentPayload (): void
249249 {
250250 $ db = $ this ->createDatabase ();
251251
252- $ fieldA = $ db ->getListCacheField (null , [
252+ $ fieldA = $ db ->getQueryCacheField (null , [
253253 Query ::orderAsc ('name ' ),
254254 Query ::cursorAfter (new Document ([
255255 '$id ' => 'cursor ' ,
256256 'name ' => 'alpha ' ,
257257 ])),
258258 ]);
259- $ fieldB = $ db ->getListCacheField (null , [
259+ $ fieldB = $ db ->getQueryCacheField (null , [
260260 Query ::orderAsc ('name ' ),
261261 Query ::cursorAfter (new Document ([
262262 '$id ' => 'cursor ' ,
@@ -267,31 +267,31 @@ public function testListCacheFieldIncludesCursorDocumentPayload(): void
267267 $ this ->assertNotSame ($ fieldA , $ fieldB );
268268 }
269269
270- public function testListCacheFieldIncludesAmbientState (): void
270+ public function testQueryCacheFieldIncludesAmbientState (): void
271271 {
272272 $ db = $ this ->createDatabase ();
273273
274- $ field = $ db ->getListCacheField (null , [Query ::limit (10 )]);
274+ $ field = $ db ->getQueryCacheField (null , [Query ::limit (10 )]);
275275
276276 $ this ->assertNotSame (
277277 $ field ,
278- $ db ->skipFilters (fn () => $ db ->getListCacheField (null , [Query ::limit (10 )]), ['json ' ]),
278+ $ db ->skipFilters (fn () => $ db ->getQueryCacheField (null , [Query ::limit (10 )]), ['json ' ]),
279279 );
280280 $ this ->assertNotSame (
281281 $ field ,
282- $ db ->skipRelationships (fn () => $ db ->getListCacheField (null , [Query ::limit (10 )])),
282+ $ db ->skipRelationships (fn () => $ db ->getQueryCacheField (null , [Query ::limit (10 )])),
283283 );
284284 }
285285
286- public function testListCacheFieldValidatesQueryTypes (): void
286+ public function testQueryCacheFieldValidatesQueryTypes (): void
287287 {
288288 $ this ->expectException (QueryException::class);
289289
290290 $ db = $ this ->createDatabase ();
291291 $ queries = ['invalid ' ];
292292
293293 /** @phpstan-ignore-next-line intentionally passing invalid query type */
294- $ db ->getListCacheField (null , $ queries );
294+ $ db ->getQueryCacheField (null , $ queries );
295295 }
296296
297297
0 commit comments