KeyKeysV12xTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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\Commands;
  11. use \PHPUnit_Framework_TestCase as StandardTestCase;
  12. /**
  13. * We only perform disconnected tests for this commands because
  14. * it is too old (Redis v1.2) and expects a different response
  15. * format.
  16. *
  17. * @group commands
  18. * @group realm-key
  19. */
  20. class KeyKeysV12xTest extends CommandTestCase
  21. {
  22. /**
  23. * {@inheritdoc}
  24. */
  25. protected function getExpectedCommand()
  26. {
  27. return 'Predis\Commands\KeyKeysV12x';
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. protected function getExpectedId()
  33. {
  34. return 'KEYS';
  35. }
  36. /**
  37. * @group disconnected
  38. */
  39. public function testFilterArguments()
  40. {
  41. $arguments = array('pattern:*');
  42. $expected = array('pattern:*');
  43. $command = $this->getCommand();
  44. $command->setArguments($arguments);
  45. $this->assertSame($expected, $command->getArguments());
  46. }
  47. /**
  48. * @group disconnected
  49. */
  50. public function testParseResponse()
  51. {
  52. $raw = 'key1 key2 key3';
  53. $parsed = array('key1', 'key2', 'key3');
  54. $this->assertSame($parsed, $this->getCommand()->parseResponse($raw));
  55. }
  56. /**
  57. * @group disconnected
  58. */
  59. public function testPrefixKeys()
  60. {
  61. $arguments = array('pattern');
  62. $expected = array('prefix:pattern');
  63. $command = $this->getCommandWithArgumentsArray($arguments);
  64. $command->prefixKeys('prefix:');
  65. $this->assertSame($expected, $command->getArguments());
  66. }
  67. }