1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace Predis\Protocol\Text;
- use PredisTestCase;
- class StatusResponseTest extends PredisTestCase
- {
-
- public function testOk()
- {
- $connection = $this->getMock('Predis\Connection\CompositeConnectionInterface');
- $connection
- ->expects($this->never())
- ->method('readLine');
- $connection
- ->expects($this->never())
- ->method('readBuffer');
- $handler = new Handler\StatusResponse();
- $response = $handler->handle($connection, 'OK');
- $this->assertInstanceOf('Predis\Response\Status', $response);
- $this->assertEquals('OK', $response);
- }
-
- public function testQueued()
- {
- $connection = $this->getMock('Predis\Connection\CompositeConnectionInterface');
- $connection
- ->expects($this->never())
- ->method('readLine');
- $connection
- ->expects($this->never())
- ->method('readBuffer');
- $handler = new Handler\StatusResponse();
- $response = $handler->handle($connection, 'QUEUED');
- $this->assertInstanceOf('Predis\Response\Status', $response);
- $this->assertEquals('QUEUED', $response);
- }
-
- public function testPlainString()
- {
- $connection = $this->getMock('Predis\Connection\CompositeConnectionInterface');
- $connection
- ->expects($this->never())
- ->method('readLine');
- $connection
- ->expects($this->never())
- ->method('readBuffer');
- $handler = new Handler\StatusResponse();
- $response = $handler->handle($connection, 'Background saving started');
- $this->assertInstanceOf('Predis\Response\Status', $response);
- $this->assertEquals('Background saving started', $response);
- }
- }
|