X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/ed9b544e10b84cd43348ddfab7068b610a5df1f7..d90b352ded98b79fdddca6e057445237531835f3:/client-libraries/php/tests.php?ds=sidebyside diff --git a/client-libraries/php/tests.php b/client-libraries/php/tests.php index 80576652..d7bf74cf 100644 --- a/client-libraries/php/tests.php +++ b/client-libraries/php/tests.php @@ -6,6 +6,9 @@ require_once('redis.php'); $r =& new Redis('localhost'); $r->connect(); +$r->select_db(9); +$r->flushdb(); +echo "
\n";
 echo $r->ping() . "\n";
 echo $r->do_echo('ECHO test') . "\n";
 echo "SET aaa " . $r->set('aaa', 'bbb') . "\n";
@@ -27,15 +30,15 @@ echo 'SET a1 a2 a3' . $r->set('a1', 'a') . $r->set('a2', 'b') . $r->set('a3', 'c
 echo 'KEYS a* ' . print_r($r->keys('a*'), true) . "\n";
 echo 'RANDOMKEY ' . $r->randomkey('a*') . "\n";
 echo 'RENAME a1 a0 ' . $r->rename('a1', 'a0') . "\n";
-echo 'RENAMENX a0 a2 ' . $r->rename('a0', 'a2', true) . "\n";
-echo 'RENAMENX a0 a1 ' . $r->rename('a0', 'a1', true) . "\n";
+echo 'RENAMENX a0 a2 ' . $r->renamenx('a0', 'a2') . "\n";
+echo 'RENAMENX a0 a1 ' . $r->renamenx('a0', 'a1') . "\n";
 
 echo 'LPUSH a0 aaa ' . $r->push('a0', 'aaa') . "\n";
 echo 'LPUSH a0 bbb ' . $r->push('a0', 'bbb') . "\n";
 echo 'RPUSH a0 ccc ' . $r->push('a0', 'ccc', false) . "\n";
 echo 'LLEN a0 ' . $r->llen('a0') . "\n";
 echo 'LRANGE sdkjhfskdjfh 0 100 ' . print_r($r->lrange('sdkjhfskdjfh', 0, 100), true) . "\n";
-echo 'LRANGE a0 0 0 ' . print_r($r->lrange('sdkjhfskdjfh', 0, 0), true) . "\n";
+echo 'LRANGE a0 0 0 ' . print_r($r->lrange('a0', 0, 0), true) . "\n";
 echo 'LRANGE a0 0 100 ' . print_r($r->lrange('a0', 0, 100), true) . "\n";
 echo 'LTRIM a0 0 1 ' . $r->ltrim('a0', 0, 1) . "\n";
 echo 'LRANGE a0 0 100 ' . print_r($r->lrange('a0', 0, 100), true) . "\n";
@@ -61,18 +64,24 @@ echo 'SREM s0 bbb ' . $r->srem('s0', 'bbb') . "\n";
 echo 'SINTER s0 s1 ' . print_r($r->sinter(array('s0', 's1')), true) . "\n";
 echo 'SMEMBERS s1 ' . print_r($r->smembers('s1'), true) . "\n";
 
-echo 'SELECT 1 ' . $r->select_db(1) . "\n";
+echo 'SELECT 8 ' . $r->select_db(8) . "\n";
+echo 'EXISTS s1 ' . $r->exists('s1') . "\n";
+if ($r->exists('s1'))
+    echo 'SMEMBERS s1 ' . print_r($r->smembers('s1'), true) . "\n";
+echo 'SELECT 9 ' . $r->select_db(9) . "\n";
 echo 'SMEMBERS s1 ' . print_r($r->smembers('s1'), true) . "\n";
-echo 'SELECT 0 ' . $r->select_db(0) . "\n";
+echo 'MOVE s1 8 ' . $r->move('s1', 8) . "\n";
+echo 'EXISTS s1 ' . $r->exists('s1') . "\n";
+if ($r->exists('s1'))
+    echo 'SMEMBERS s1 ' . print_r($r->smembers('s1'), true) . "\n";
+echo 'SELECT 8 ' . $r->select_db(8) . "\n";
 echo 'SMEMBERS s1 ' . print_r($r->smembers('s1'), true) . "\n";
-echo 'MOVE s1 1 ' . $r->move('s1', 1) . "\n";
-echo 'SMEMBERS s1 ' . print_r($r->smembers('s1'), true) . "\n";
-echo 'SELECT 1 ' . $r->select_db(1) . "\n";
-echo 'SMEMBERS s1 ' . print_r($r->smembers('s1'), true) . "\n";
-echo 'SELECT 0 ' . $r->select_db(0) . "\n";
+echo 'SELECT 9 ' . $r->select_db(9) . "\n";
 
 echo 'SAVE ' . $r->save() . "\n";
 echo 'BGSAVE ' . $r->save(true) . "\n";
 echo 'LASTSAVE ' . $r->lastsave() . "\n";
 
-?>
\ No newline at end of file
+echo 'INFO ' . print_r($r->info()) . "\n";
+echo "
\n"; +?>