ErrorResponseTest.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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\Protocol\Text;
  11. use PredisTestCase;
  12. /**
  13. *
  14. */
  15. class ErrorResponseTest extends PredisTestCase
  16. {
  17. /**
  18. * @group disconnected
  19. */
  20. public function testOk()
  21. {
  22. $message = 'ERR Operation against a key holding the wrong kind of value';
  23. $connection = $this->getMock('Predis\Connection\CompositeConnectionInterface');
  24. $connection
  25. ->expects($this->never())
  26. ->method('readLine');
  27. $connection
  28. ->expects($this->never())
  29. ->method('readBuffer');
  30. $handler = new Handler\ErrorResponse();
  31. $response = $handler->handle($connection, $message);
  32. $this->assertInstanceOf('Predis\Response\Error', $response);
  33. $this->assertSame($message, $response->getMessage());
  34. }
  35. }