@@ -354,7 +354,7 @@ public function testGetSet() {
354354    public  function  testRandomKey () {
355355        for ($ i  = 0 ; $ i  < 1000 ; $ i ++) {
356356            $ k  = $ this  ->redis ->randomKey ();
357-             $ this  ->assertTrue ($ this  ->redis ->exists ($ k ));
357+             $ this  ->assertEquals ($ this  ->redis ->exists ($ k ),  1 );
358358        }
359359    }
360360
@@ -555,7 +555,7 @@ public function testIncrByFloat()
555555        $ this  ->redis ->incrbyfloat ('key ' ,1.8 );
556556        $ this  ->assertEquals (1.8 , floatval ($ this  ->redis ->get ('key ' ))); // convert to float to avoid rounding issue on arm 
557557        $ this  ->redis ->setOption (Redis::OPT_PREFIX , '' );
558-         $ this  ->assertTrue ( $ this  ->redis ->exists ('someprefix:key ' ));
558+         $ this  ->assertEquals ( 1 ,  $ this  ->redis ->exists ('someprefix:key ' ));
559559        $ this  ->redis ->del ('someprefix:key ' );
560560
561561    }
@@ -586,10 +586,25 @@ public function testDecr()
586586
587587    public  function  testExists ()
588588    {
589+         /* Single key */ 
589590        $ this  ->redis ->del ('key ' );
590-         $ this  ->assertFalse ( $ this  ->redis ->exists ('key ' ));
591+         $ this  ->assertEquals ( 0 ,  $ this  ->redis ->exists ('key ' ));
591592        $ this  ->redis ->set ('key ' , 'val ' );
592-         $ this  ->assertEquals (True , $ this  ->redis ->exists ('key ' ));
593+         $ this  ->assertEquals (1 , $ this  ->redis ->exists ('key ' ));
594+ 
595+         /* Add multiple keys */ 
596+         $ mkeys  = [];
597+         for  ($ i  = 0 ; $ i  < 10 ; $ i ++) {
598+             if  (rand (1 , 2 ) == 1 ) {
599+                 $ mkey  = "{exists}key: $ i " ;
600+                 $ this  ->redis ->set ($ mkey , $ i );
601+                 $ mkeys [] = $ mkey ;
602+             }
603+         }
604+ 
605+         /* Test passing an array as well as the keys variadic */ 
606+         $ this  ->assertEquals (count ($ mkeys ), $ this  ->redis ->exists ($ mkeys ));
607+         $ this  ->assertEquals (count ($ mkeys ), call_user_func_array ([$ this  ->redis , 'exists ' ], $ mkeys ));
593608    }
594609
595610    public  function  testGetKeys ()
@@ -4089,7 +4104,7 @@ private function checkSerializer($mode) {
40894104        $ this  ->redis ->sAdd ('k ' , 'a ' , 'b ' , 'c ' , 'd ' );
40904105        $ this  ->assertTrue (2  === $ this  ->redis ->sRem ('k ' , 'a ' , 'd ' ));
40914106        $ this  ->assertTrue (2  === $ this  ->redis ->sRem ('k ' , 'b ' , 'c ' , 'e ' ));
4092-         $ this  ->assertTrue ( FALSE  ===  $ this  ->redis ->exists ('k ' ));
4107+         $ this  ->assertEquals ( 0 ,  $ this  ->redis ->exists ('k ' ));
40934108
40944109        // sismember 
40954110        $ this  ->assertTrue (TRUE  === $ this  ->redis ->sismember ('{set}key ' , $ s [0 ]));
0 commit comments