123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- namespace Predis\Commands;
- use \PHPUnit_Framework_TestCase as StandardTestCase;
- class HashValuesTest extends CommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Commands\HashValues';
- }
-
- protected function getExpectedId()
- {
- return 'HVALS';
- }
-
- public function testFilterArguments()
- {
- $arguments = array('key');
- $expected = array('key');
- $command = $this->getCommand();
- $command->setArguments($arguments);
- $this->assertSame($expected, $command->getArguments());
- }
-
- public function testParseResponse()
- {
- $raw = array('foo', 'hoge', 'lol');
- $expected = array('foo', 'hoge', 'lol');
- $command = $this->getCommand();
- $this->assertSame($expected, $command->parseResponse($raw));
- }
-
- public function testPrefixKeys()
- {
- $arguments = array('key');
- $expected = array('prefix:key');
- $command = $this->getCommandWithArgumentsArray($arguments);
- $command->prefixKeys('prefix:');
- $this->assertSame($expected, $command->getArguments());
- }
-
- public function testReturnsValuesOfHash()
- {
- $redis = $this->getClient();
- $redis->hmset('metavars', 'foo', 'bar', 'hoge', 'piyo', 'lol', 'wut');
- $this->assertSame(array('bar', 'piyo', 'wut'), $redis->hvals('metavars'));
- $this->assertSame(array(), $redis->hvals('unknown'));
- }
-
- public function testThrowsExceptionOnWrongType()
- {
- $redis = $this->getClient();
- $redis->set('foo', 'bar');
- $redis->hvals('foo');
- }
- }
|