@@ -1457,15 +1457,15 @@ public function testHashes() {
14571457 $ this ->redis ->delete ('h ' , 'key ' );
14581458
14591459 $ this ->assertTrue (0 === $ this ->redis ->hLen ('h ' ));
1460- $ this ->assertTrue (TRUE === $ this ->redis ->hSet ('h ' , 'a ' , 'a-value ' ));
1460+ $ this ->assertTrue (1 === $ this ->redis ->hSet ('h ' , 'a ' , 'a-value ' ));
14611461 $ this ->assertTrue (1 === $ this ->redis ->hLen ('h ' ));
1462- $ this ->assertTrue (TRUE === $ this ->redis ->hSet ('h ' , 'b ' , 'b-value ' ));
1462+ $ this ->assertTrue (1 === $ this ->redis ->hSet ('h ' , 'b ' , 'b-value ' ));
14631463 $ this ->assertTrue (2 === $ this ->redis ->hLen ('h ' ));
14641464
14651465 $ this ->assertTrue ('a-value ' === $ this ->redis ->hGet ('h ' , 'a ' )); // simple get
14661466 $ this ->assertTrue ('b-value ' === $ this ->redis ->hGet ('h ' , 'b ' )); // simple get
14671467
1468- $ this ->assertTrue (FALSE === $ this ->redis ->hSet ('h ' , 'a ' , 'another-value ' )); // replacement
1468+ $ this ->assertTrue (0 === $ this ->redis ->hSet ('h ' , 'a ' , 'another-value ' )); // replacement
14691469 $ this ->assertTrue ('another-value ' === $ this ->redis ->hGet ('h ' , 'a ' )); // get the new value
14701470
14711471 $ this ->assertTrue ('b-value ' === $ this ->redis ->hGet ('h ' , 'b ' )); // simple get
@@ -1508,7 +1508,6 @@ public function testHashes() {
15081508 $ this ->assertTrue (FALSE === $ this ->redis ->hIncrBy ('h ' , 'y ' , 1 ));
15091509 }
15101510
1511-
15121511 public function testMultiExec () {
15131512 $ this ->sequence (Redis::MULTI );
15141513 }
@@ -1997,24 +1996,35 @@ protected function sequence($mode) {
19971996 ->hexists ('hkey1 ' , 'key2 ' )
19981997 ->hkeys ('hkey1 ' )
19991998 ->hvals ('hkey1 ' )
2000- // ->hgetall('hkey1')
2001- //->hincrby()
1999+ ->hgetall ('hkey1 ' )
2000+ ->hset ('hkey1 ' , 'valn ' , 1 )
2001+ ->hincrby ('hkey1 ' , 'valn ' , 4 )
2002+ ->hincrby ('hkey1 ' , 'val-fail ' , 42 )
2003+ ->hset ('hkey1 ' , 'val-fail ' , 'non-string ' )
2004+ ->hget ('hkey1 ' , 'val-fail ' )
2005+ ->hincrby ('hkey1 ' , 'val-fail ' , 42 )
20022006 ->exec ();
20032007
20042008 $ i = 0 ;
20052009 $ this ->assertTrue (is_array ($ ret ));
20062010 $ this ->assertTrue ($ ret [$ i ++] <= 1 ); // delete
2007- $ this ->assertTrue ($ ret [$ i ++] === TRUE ); // added 1 element
2008- $ this ->assertTrue ($ ret [$ i ++] === TRUE ); // added 1 element
2009- $ this ->assertTrue ($ ret [$ i ++] === TRUE ); // added 1 element
2011+ $ this ->assertTrue ($ ret [$ i ++] === 1 ); // added 1 element
2012+ $ this ->assertTrue ($ ret [$ i ++] === 1 ); // added 1 element
2013+ $ this ->assertTrue ($ ret [$ i ++] === 1 ); // added 1 element
20102014 $ this ->assertTrue ($ ret [$ i ++] === 'value1 ' ); // hget
20112015 $ this ->assertTrue ($ ret [$ i ++] === 3 ); // hlen
20122016 $ this ->assertTrue ($ ret [$ i ++] === TRUE ); // hdel succeeded
20132017 $ this ->assertTrue ($ ret [$ i ++] === FALSE ); // hdel failed
20142018 $ this ->assertTrue ($ ret [$ i ++] === FALSE ); // hexists didn't find the deleted key
20152019 $ this ->assertTrue ($ ret [$ i ] === array ('key1 ' , 'key3 ' ) || $ ret [$ i ] === array ('key3 ' , 'key1 ' )); $ i ++; // hkeys
20162020 $ this ->assertTrue ($ ret [$ i ] === array ('value1 ' , 'value3 ' ) || $ ret [$ i ] === array ('value3 ' , 'value1 ' )); $ i ++; // hvals
2017- //$this->assertTrue($ret[$i] === array('key1' => 'value1', 'key3' => 'value3') || $ret[$i] === array('key3' => 'value3', 'key1' => 'value1')); $i++; // hgetall
2021+ $ this ->assertTrue ($ ret [$ i ] === array ('key1 ' => 'value1 ' , 'key3 ' => 'value3 ' ) || $ ret [$ i ] === array ('key3 ' => 'value3 ' , 'key1 ' => 'value1 ' )); $ i ++; // hgetall
2022+ $ this ->assertTrue ($ ret [$ i ++] === 1 ); // added 1 element
2023+ $ this ->assertTrue ($ ret [$ i ++] === 5 ); // added 4 to value 1 → 5
2024+ $ this ->assertTrue ($ ret [$ i ++] === 42 ); // member doesn't exist → assume 0, and then add.
2025+ $ this ->assertTrue ($ ret [$ i ++] === 0 ); // didn't add the element, already present, so 0.
2026+ $ this ->assertTrue ($ ret [$ i ++] === 'non-string ' ); // hset succeeded
2027+ $ this ->assertTrue ($ ret [$ i ++] === FALSE ); // member isn't a number → fail.
20182028 $ this ->assertTrue (count ($ ret ) === $ i );
20192029
20202030 }
0 commit comments