CompositeStreamConnectionTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\Connection;
  11. /**
  12. *
  13. */
  14. class CompositeStreamConnectionTest extends PredisConnectionTestCase
  15. {
  16. const CONNECTION_CLASS = 'Predis\Connection\CompositeStreamConnection';
  17. // ******************************************************************** //
  18. // ---- INTEGRATION TESTS --------------------------------------------- //
  19. // ******************************************************************** //
  20. /**
  21. * @group connected
  22. */
  23. public function testReadsMultibulkResponsesAsIterators()
  24. {
  25. $connection = $this->createConnection(true);
  26. $profile = $this->getCurrentProfile();
  27. $connection->getProtocol()->useIterableMultibulk(true);
  28. $connection->executeCommand($profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol')));
  29. $connection->writeRequest($profile->createCommand('lrange', array('metavars', 0, -1)));
  30. $this->assertInstanceOf('Predis\Response\Iterator\MultiBulkIterator', $iterator = $connection->read());
  31. $this->assertSame(array('foo', 'hoge', 'lol'), iterator_to_array($iterator));
  32. }
  33. }