12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace Predis\Command;
- class KeyTypeTest extends PredisCommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Command\KeyType';
- }
-
- protected function getExpectedId()
- {
- return 'TYPE';
- }
-
- public function testFilterArguments()
- {
- $arguments = array('key');
- $expected = array('key');
- $command = $this->getCommand();
- $command->setArguments($arguments);
- $this->assertSame($expected, $command->getArguments());
- }
-
- public function testParseResponse()
- {
- $this->assertSame('none', $this->getCommand()->parseResponse('none'));
- }
-
- public function testReturnsTypeOfKey()
- {
- $redis = $this->getClient();
- $this->assertEquals('none', $redis->type('type:keydoesnotexist'));
- $redis->set('type:string', 'foobar');
- $this->assertEquals('string', $redis->type('type:string'));
- $redis->lpush('type:list', 'foobar');
- $this->assertEquals('list', $redis->type('type:list'));
- $redis->sadd('type:set', 'foobar');
- $this->assertEquals('set', $redis->type('type:set'));
- $redis->zadd('type:zset', 0, 'foobar');
- $this->assertEquals('zset', $redis->type('type:zset'));
- $redis->hset('type:hash', 'foo', 'bar');
- $this->assertEquals('hash', $redis->type('type:hash'));
- }
- }
|