@@ -345,6 +345,69 @@ public function testEvalSHA() {
345
345
$ this ->assertTrue (1 === $ this ->redis ->eval ($ scr ,Array ($ str_key ), 1 ));
346
346
$ this ->assertTrue (1 === $ this ->redis ->evalsha ($ sha ,Array ($ str_key ), 1 ));
347
347
}
348
+
349
+ public function testEvalBulkResponse () {
350
+ $ str_key1 = uniqid () . '- ' . rand (1 ,1000 ) . '{hash} ' ;
351
+ $ str_key2 = uniqid () . '- ' . rand (1 ,1000 ) . '{hash} ' ;
352
+
353
+ $ this ->redis ->script ($ str_key1 , 'flush ' );
354
+ $ this ->redis ->script ($ str_key2 , 'flush ' );
355
+
356
+ $ scr = "return {KEYS[1],KEYS[2]} " ;
357
+
358
+ $ result = $ this ->redis ->eval ($ scr ,Array ($ str_key1 , $ str_key2 ), 2 );
359
+
360
+ $ this ->assertTrue ($ str_key1 === $ result [0 ]);
361
+ $ this ->assertTrue ($ str_key2 === $ result [1 ]);
362
+ }
363
+
364
+ public function testEvalBulkResponseMulti () {
365
+ $ str_key1 = uniqid () . '- ' . rand (1 ,1000 ) . '{hash} ' ;
366
+ $ str_key2 = uniqid () . '- ' . rand (1 ,1000 ) . '{hash} ' ;
367
+
368
+ $ this ->redis ->script ($ str_key1 , 'flush ' );
369
+ $ this ->redis ->script ($ str_key2 , 'flush ' );
370
+
371
+ $ scr = "return {KEYS[1],KEYS[2]} " ;
372
+
373
+ $ this ->redis ->multi ();
374
+ $ this ->redis ->eval ($ scr ,Array ($ str_key1 , $ str_key2 ), 2 );
375
+
376
+ $ result = $ this ->redis ->exec ();
377
+
378
+ $ this ->assertTrue ($ str_key1 === $ result [0 ][0 ]);
379
+ $ this ->assertTrue ($ str_key2 === $ result [0 ][1 ]);
380
+ }
381
+
382
+ public function testEvalBulkEmptyResponse () {
383
+ $ str_key1 = uniqid () . '- ' . rand (1 ,1000 ) . '{hash} ' ;
384
+ $ str_key2 = uniqid () . '- ' . rand (1 ,1000 ) . '{hash} ' ;
385
+
386
+ $ this ->redis ->script ($ str_key1 , 'flush ' );
387
+ $ this ->redis ->script ($ str_key2 , 'flush ' );
388
+
389
+ $ scr = "for _,key in ipairs(KEYS) do redis.call('SET', key, 'value') end " ;
390
+
391
+ $ result = $ this ->redis ->eval ($ scr ,Array ($ str_key1 , $ str_key2 ), 2 );
392
+
393
+ $ this ->assertTrue (null === $ result );
394
+ }
395
+
396
+ public function testEvalBulkEmptyResponseMulti () {
397
+ $ str_key1 = uniqid () . '- ' . rand (1 ,1000 ) . '{hash} ' ;
398
+ $ str_key2 = uniqid () . '- ' . rand (1 ,1000 ) . '{hash} ' ;
399
+
400
+ $ this ->redis ->script ($ str_key1 , 'flush ' );
401
+ $ this ->redis ->script ($ str_key2 , 'flush ' );
402
+
403
+ $ scr = "for _,key in ipairs(KEYS) do redis.call('SET', key, 'value') end " ;
404
+
405
+ $ this ->redis ->multi ();
406
+ $ this ->redis ->eval ($ scr ,Array ($ str_key1 , $ str_key2 ), 2 );
407
+ $ result = $ this ->redis ->exec ();
408
+
409
+ $ this ->assertTrue (null === $ result [0 ]);
410
+ }
348
411
349
412
/* Cluster specific introspection stuff */
350
413
public function testIntrospection () {
0 commit comments