1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- /*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Predis\Protocol\Text;
- use PredisTestCase;
- /**
- *
- */
- class StatusResponseTest extends PredisTestCase
- {
- /**
- * @group disconnected
- */
- 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);
- }
- /**
- * @group disconnected
- */
- 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);
- }
- /**
- * @group disconnected
- */
- 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);
- }
- }
|