123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace Predis\Command\Redis;
- class GEOHASH_Test extends PredisCommandTestCase
- {
-
- protected function getExpectedCommand()
- {
- return 'Predis\Command\Redis\GEOHASH';
- }
-
- protected function getExpectedId()
- {
- return 'GEOHASH';
- }
-
- public function testFilterArguments()
- {
- $arguments = array('key', 'member:1', 'member:2');
- $expected = array('key', 'member:1', 'member:2');
- $command = $this->getCommand();
- $command->setArguments($arguments);
- $this->assertSame($expected, $command->getArguments());
- }
-
- public function testFilterArgumentsWithMembersAsSingleArray()
- {
- $arguments = array('key', array('member:1', 'member:2'));
- $expected = array('key', 'member:1', 'member:2');
- $command = $this->getCommand();
- $command->setArguments($arguments);
- $this->assertSame($expected, $command->getArguments());
- }
-
- public function testParseResponse()
- {
- $raw = array('sqc8b49rny0', 'sqdtr74hyu0');
- $expected = array('sqc8b49rny0', 'sqdtr74hyu0');
- $command = $this->getCommand();
- $this->assertSame($expected, $command->parseResponse($raw));
- }
-
- public function testCommandReturnsGeoHashes()
- {
- $redis = $this->getClient();
- $redis->geoadd('Sicily', '13.361389', '38.115556', 'Palermo', '15.087269', '37.502669', 'Catania');
- $this->assertSame(array('sqc8b49rny0', 'sqdtr74hyu0'), $redis->geohash('Sicily', 'Palermo', 'Catania'));
- }
-
- public function testThrowsExceptionOnWrongType()
- {
- $redis = $this->getClient();
- $redis->lpush('Sicily', 'Palermo');
- $redis->geohash('Sicily', 'Palermo');
- }
- }
|