@@ -453,9 +453,9 @@ public function testStr() {
453453 $ this ->assertTrue ($ this ->redis ->get ('keyNotExist ' ) === 'value ' );
454454
455455 $ this ->redis ->set ('key ' , 'This is a string ' ) ;
456- $ this ->assertTrue ($ this ->redis ->substr ('key ' , 0 , 3 ) === 'This ' );
457- $ this ->assertTrue ($ this ->redis ->substr ('key ' , -6 , -1 ) === 'string ' );
458- $ this ->assertTrue ($ this ->redis ->substr ('key ' , -6 , 100000 ) === 'string ' );
456+ $ this ->assertTrue ($ this ->redis ->getRange ('key ' , 0 , 3 ) === 'This ' );
457+ $ this ->assertTrue ($ this ->redis ->getRange ('key ' , -6 , -1 ) === 'string ' );
458+ $ this ->assertTrue ($ this ->redis ->getRange ('key ' , -6 , 100000 ) === 'string ' );
459459 $ this ->assertTrue ($ this ->redis ->get ('key ' ) === 'This is a string ' );
460460
461461 $ this ->redis ->set ('key ' , 'This is a string ' ) ;
@@ -1778,6 +1778,25 @@ public function testHashes() {
17781778
17791779 }
17801780
1781+ public function testSetRange () {
1782+
1783+ $ this ->redis ->delete ('key ' );
1784+ $ this ->redis ->set ('key ' , 'hello world ' );
1785+ $ this ->redis ->setRange ('key ' , 6 , 'redis ' );
1786+ $ this ->assertTrue ('hello redis ' === $ this ->redis ->get ('key ' ));
1787+ $ this ->redis ->setRange ('key ' , 6 , 'you ' ); // don't cut off the end
1788+ $ this ->assertTrue ('hello youis ' === $ this ->redis ->get ('key ' ));
1789+
1790+ $ this ->assertTrue (FALSE === $ this ->redis ->setRange ('key ' , -1 , 'plop ' )); // doesn't work with negative offsets
1791+
1792+ // fill with zeros if needed
1793+ $ this ->redis ->delete ('key ' );
1794+ $ this ->redis ->setRange ('key ' , 6 , 'foo ' );
1795+ $ this ->assertTrue ("\x00\x00\x00\x00\x00\x00foo " === $ this ->redis ->get ('key ' ));
1796+
1797+
1798+ }
1799+
17811800 public function testMultiExec () {
17821801 $ this ->sequence (Redis::MULTI );
17831802
0 commit comments