ListPopLastPushHeadBlockingTest.php 1.8 KB

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