SUBSTR_Test.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis\Command\Redis;
  11. /**
  12. * SUBSTR is actually the old name of GETRANGE in version of Redis <= 2.0.
  13. * This command should be considered obsolete and we will perform any kind
  14. * of tests against a Redis server for this one.
  15. *
  16. * @group commands
  17. * @group realm-string
  18. */
  19. class SUBSTR_Test extends PredisCommandTestCase
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. protected function getExpectedCommand()
  25. {
  26. return 'Predis\Command\Redis\SUBSTR';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. protected function getExpectedId()
  32. {
  33. return 'SUBSTR';
  34. }
  35. /**
  36. * @group disconnected
  37. */
  38. public function testFilterArguments()
  39. {
  40. $arguments = array('key', 5, 10);
  41. $expected = array('key', 5, 10);
  42. $command = $this->getCommand();
  43. $command->setArguments($arguments);
  44. $this->assertSame($expected, $command->getArguments());
  45. }
  46. /**
  47. * @group disconnected
  48. */
  49. public function testParseResponse()
  50. {
  51. $this->assertSame('substring', $this->getCommand()->parseResponse('substring'));
  52. }
  53. }