@@ -3237,6 +3237,24 @@ public function testHashes() {
32373237 $ this ->assertEquals ('Object ' , $ h1 ['z ' ]);
32383238 $ this ->assertEquals ('' , $ h1 ['t ' ]);
32393239
3240+ // hset with fields + values as an associative array
3241+ if (version_compare ($ this ->version , '4.0.0 ' ) >= 0 ) {
3242+ $ this ->redis ->del ('h ' );
3243+ $ this ->assertEquals (3 , $ this ->redis ->hSet ('h ' , ['x ' => 123 , 'y ' => 456 , 'z ' => 'abc ' ]));
3244+ $ this ->assertEquals (['x ' => '123 ' , 'y ' => '456 ' , 'z ' => 'abc ' ], $ this ->redis ->hGetAll ('h ' ));
3245+ $ this ->assertEquals (0 , $ this ->redis ->hSet ('h ' , ['x ' => 789 ]));
3246+ $ this ->assertEquals (['x ' => '789 ' , 'y ' => '456 ' , 'z ' => 'abc ' ], $ this ->redis ->hGetAll ('h ' ));
3247+ }
3248+
3249+ // hset with variadic fields + values
3250+ if (version_compare ($ this ->version , '4.0.0 ' ) >= 0 ) {
3251+ $ this ->redis ->del ('h ' );
3252+ $ this ->assertEquals (3 , $ this ->redis ->hSet ('h ' , 'x ' , 123 , 'y ' , 456 , 'z ' , 'abc ' ));
3253+ $ this ->assertEquals (['x ' => '123 ' , 'y ' => '456 ' , 'z ' => 'abc ' ], $ this ->redis ->hGetAll ('h ' ));
3254+ $ this ->assertEquals (0 , $ this ->redis ->hSet ('h ' , 'x ' , 789 ));
3255+ $ this ->assertEquals (['x ' => '789 ' , 'y ' => '456 ' , 'z ' => 'abc ' ], $ this ->redis ->hGetAll ('h ' ));
3256+ }
3257+
32403258 // hstrlen
32413259 if (version_compare ($ this ->version , '3.2.0 ' ) >= 0 ) {
32423260 $ this ->redis ->del ('h ' );
0 commit comments