1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace Predis\Command;
- class ZSetCardinalityTest extends PredisCommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Command\ZSetCardinality';
- }
-
- protected function getExpectedId()
- {
- return 'ZCARD';
- }
-
- 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 testReturnsSizeOfSortedSet()
- {
- $redis = $this->getClient();
- $redis->zadd('letters', 1, 'a', 2, 'b', 3, 'c');
- $this->assertSame(3, $redis->zcard('letters'));
- $this->assertSame(0, $redis->zcard('unknown'));
- }
-
- public function testThrowsExceptionOnWrongType()
- {
- $redis = $this->getClient();
- $redis->set('foo', 'bar');
- $redis->zcard('foo');
- }
- }
|