@@ -696,47 +696,57 @@ public function testUnlink() {
696696
697697 public function testType ()
698698 {
699- // 0 => none, (key didn't exist)
700- // 1=> string,
701- // 2 => set,
702- // 3 => list,
703- // 4 => zset,
704- // 5 => hash
705-
706- // string
707- $ this ->redis ->set ('key ' , 'val ' );
708- $ this ->assertEquals (Redis::REDIS_STRING , $ this ->redis ->type ('key ' ));
709-
710- // list
711- $ this ->redis ->lPush ('keyList ' , 'val0 ' );
712- $ this ->redis ->lPush ('keyList ' , 'val1 ' );
713- $ this ->assertEquals (Redis::REDIS_LIST , $ this ->redis ->type ('keyList ' ));
714-
715- // set
716- $ this ->redis ->del ('keySet ' );
717- $ this ->redis ->sAdd ('keySet ' , 'val0 ' );
718- $ this ->redis ->sAdd ('keySet ' , 'val1 ' );
719- $ this ->assertEquals (Redis::REDIS_SET , $ this ->redis ->type ('keySet ' ));
720-
721- // sadd with numeric key
722- $ this ->redis ->del (123 );
723- $ this ->assertTrue (1 === $ this ->redis ->sAdd (123 , 'val0 ' ));
724- $ this ->assertTrue (['val0 ' ] === $ this ->redis ->sMembers (123 ));
725-
726- // zset
727- $ this ->redis ->del ('keyZSet ' );
728- $ this ->redis ->zAdd ('keyZSet ' , 0 , 'val0 ' );
729- $ this ->redis ->zAdd ('keyZSet ' , 1 , 'val1 ' );
730- $ this ->assertEquals (Redis::REDIS_ZSET , $ this ->redis ->type ('keyZSet ' ));
731-
732- // hash
733- $ this ->redis ->del ('keyHash ' );
734- $ this ->redis ->hSet ('keyHash ' , 'key0 ' , 'val0 ' );
735- $ this ->redis ->hSet ('keyHash ' , 'key1 ' , 'val1 ' );
736- $ this ->assertEquals (Redis::REDIS_HASH , $ this ->redis ->type ('keyHash ' ));
737-
738- //None
739- $ this ->assertEquals (Redis::REDIS_NOT_FOUND , $ this ->redis ->type ('keyNotExists ' ));
699+ // 0 => none, (key didn't exist)
700+ // 1=> string,
701+ // 2 => set,
702+ // 3 => list,
703+ // 4 => zset,
704+ // 5 => hash
705+ // 6 => stream
706+
707+ // string
708+ $ this ->redis ->set ('key ' , 'val ' );
709+ $ this ->assertEquals (Redis::REDIS_STRING , $ this ->redis ->type ('key ' ));
710+
711+ // list
712+ $ this ->redis ->lPush ('keyList ' , 'val0 ' );
713+ $ this ->redis ->lPush ('keyList ' , 'val1 ' );
714+ $ this ->assertEquals (Redis::REDIS_LIST , $ this ->redis ->type ('keyList ' ));
715+
716+ // set
717+ $ this ->redis ->del ('keySet ' );
718+ $ this ->redis ->sAdd ('keySet ' , 'val0 ' );
719+ $ this ->redis ->sAdd ('keySet ' , 'val1 ' );
720+ $ this ->assertEquals (Redis::REDIS_SET , $ this ->redis ->type ('keySet ' ));
721+
722+ // sadd with numeric key
723+ $ this ->redis ->del (123 );
724+ $ this ->assertTrue (1 === $ this ->redis ->sAdd (123 , 'val0 ' ));
725+ $ this ->assertTrue (['val0 ' ] === $ this ->redis ->sMembers (123 ));
726+
727+ // zset
728+ $ this ->redis ->del ('keyZSet ' );
729+ $ this ->redis ->zAdd ('keyZSet ' , 0 , 'val0 ' );
730+ $ this ->redis ->zAdd ('keyZSet ' , 1 , 'val1 ' );
731+ $ this ->assertEquals (Redis::REDIS_ZSET , $ this ->redis ->type ('keyZSet ' ));
732+
733+ // hash
734+ $ this ->redis ->del ('keyHash ' );
735+ $ this ->redis ->hSet ('keyHash ' , 'key0 ' , 'val0 ' );
736+ $ this ->redis ->hSet ('keyHash ' , 'key1 ' , 'val1 ' );
737+ $ this ->assertEquals (Redis::REDIS_HASH , $ this ->redis ->type ('keyHash ' ));
738+
739+ // stream
740+ if ($ this ->minVersionCheck ("5.0 " )) {
741+ $ this ->redis ->del ('stream ' );
742+ $ this ->redis ->xAdd ('stream ' , '* ' , ['foo ' => 'bar ' ]);
743+ $ this ->assertEquals (Redis::REDIS_STREAM , $ this ->redis ->type ('stream ' ));
744+ }
745+
746+ // None
747+ $ this ->redis ->del ('keyNotExists ' );
748+ $ this ->assertEquals (Redis::REDIS_NOT_FOUND , $ this ->redis ->type ('keyNotExists ' ));
749+
740750 }
741751
742752 public function testStr () {
@@ -2447,7 +2457,7 @@ public function testZPop() {
24472457 $ this ->redis ->del ('key ' );
24482458 $ this ->redis ->zAdd ('key ' , 0 , 'a ' , 1 , 'b ' , 2 , 'c ' , 3 , 'd ' , 4 , 'e ' );
24492459 $ this ->assertTrue (array ('e ' => 4.0 , 'd ' => 3.0 , 'c ' => 2.0 ) === $ this ->redis ->zPopMax ('key ' , 3 ));
2450-
2460+
24512461 // zPopMin with a COUNT argument
24522462 $ this ->redis ->del ('key ' );
24532463 $ this ->redis ->zAdd ('key ' , 0 , 'a ' , 1 , 'b ' , 2 , 'c ' , 3 , 'd ' , 4 , 'e ' );
0 commit comments