ListPopLastPushHeadBlockingTest.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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;
  11. /**
  12. * @group commands
  13. * @group realm-list
  14. * @todo Testing blocking pop operations against Redis using PHP is
  15. * tricky, so we will skip these kind of tests for now.
  16. */
  17. class ListPopLastPushHeadBlockingTest extends PredisCommandTestCase
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. protected function getExpectedCommand()
  23. {
  24. return 'Predis\Command\ListPopLastPushHeadBlocking';
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. protected function getExpectedId()
  30. {
  31. return 'BRPOPLPUSH';
  32. }
  33. /**
  34. * @group disconnected
  35. */
  36. public function testFilterArguments()
  37. {
  38. $arguments = array('key:source', 'key:destination', 10);
  39. $expected = array('key:source', 'key:destination', 10);
  40. $command = $this->getCommand();
  41. $command->setArguments($arguments);
  42. $this->assertSame($expected, $command->getArguments());
  43. }
  44. /**
  45. * @group disconnected
  46. */
  47. public function testParseResponse()
  48. {
  49. $this->assertSame('element', $this->getCommand()->parseResponse('element'));
  50. }
  51. /**
  52. * @group disconnected
  53. */
  54. public function testPrefixKeys()
  55. {
  56. $arguments = array('key:source', 'key:destination', 10);
  57. $expected = array('prefix:key:source', 'prefix:key:destination', 10);
  58. $command = $this->getCommandWithArgumentsArray($arguments);
  59. $command->prefixKeys('prefix:');
  60. $this->assertSame($expected, $command->getArguments());
  61. }
  62. /**
  63. * @group disconnected
  64. */
  65. public function testPrefixKeysIgnoredOnEmptyArguments()
  66. {
  67. $command = $this->getCommand();
  68. $command->prefixKeys('prefix:');
  69. $this->assertSame(array(), $command->getArguments());
  70. }
  71. }