1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace Predis\Command;
- class HashLengthTest extends PredisCommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Command\HashLength';
- }
-
- protected function getExpectedId()
- {
- return 'HLEN';
- }
-
- 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(1, $this->getCommand()->parseResponse(1));
- }
-
- public function testReturnsLengthOfHash()
- {
- $redis = $this->getClient();
- $redis->hmset('metavars', 'foo', 'bar', 'hoge', 'piyo', 'lol', 'wut');
- $this->assertSame(3, $redis->hlen('metavars'));
- $this->assertSame(0, $redis->hlen('unknown'));
- }
-
- public function testThrowsExceptionOnWrongType()
- {
- $redis = $this->getClient();
- $redis->set('foo', 'bar');
- $redis->hlen('foo');
- }
- }
|