1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace Predis\Command\Redis;
- class RENAME_Test extends PredisCommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Command\Redis\RENAME';
- }
-
- protected function getExpectedId()
- {
- return 'RENAME';
- }
-
- public function testFilterArguments()
- {
- $arguments = array('key', 'newkey');
- $expected = array('key', 'newkey');
- $command = $this->getCommand();
- $command->setArguments($arguments);
- $this->assertSame($expected, $command->getArguments());
- }
-
- public function testParseResponse()
- {
- $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
- }
-
- public function testRenamesKeys()
- {
- $redis = $this->getClient();
- $redis->set('foo', 'bar');
- $this->assertEquals('OK', $redis->rename('foo', 'foofoo'));
- $this->assertSame(0, $redis->exists('foo'));
- $this->assertSame(1, $redis->exists('foofoo'));
- }
-
- public function testThrowsExceptionOnNonExistingKeys()
- {
- $redis = $this->getClient();
- $redis->rename('foo', 'foobar');
- }
- }
|