ResponseErrorHandlerTest.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 \PHPUnit_Framework_TestCase as StandardTestCase;
  12. /**
  13. *
  14. */
  15. class ResponseErrorHandlerTest extends StandardTestCase
  16. {
  17. /**
  18. * @group disconnected
  19. */
  20. public function testOk()
  21. {
  22. $handler = new ResponseErrorHandler();
  23. $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface');
  24. $connection->expects($this->never())->method('readLine');
  25. $connection->expects($this->never())->method('readBytes');
  26. $message = "ERR Operation against a key holding the wrong kind of value";
  27. $response = $handler->handle($connection, $message);
  28. $this->assertInstanceOf('Predis\ResponseError', $response);
  29. $this->assertSame($message, $response->getMessage());
  30. }
  31. }