mirror of
https://github.com/predis/predis.git
synced 2026-09-06 07:56:32 +00:00
[tests] Fix tests from previous commit.
They did work, but I am not exactly sure why. Also added a missing test for Predis\Connection\CompositeStreamConnection.
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace Predis\Connection;
|
||||
|
||||
use Predis\Command\RawCommand;
|
||||
use Predis\Response\Error as ErrorResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -18,6 +21,32 @@ class CompositeStreamConnectionTest extends PredisConnectionTestCase
|
||||
{
|
||||
const CONNECTION_CLASS = 'Predis\Connection\CompositeStreamConnection';
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
* @expectedException \Predis\Connection\ConnectionException
|
||||
* @expectedExceptionMessage `SELECT` failed: ERR invalid DB index [tcp://127.0.0.1:6379]
|
||||
*/
|
||||
public function testThrowsExceptionOnInitializationCommandFailure()
|
||||
{
|
||||
$cmdSelect = RawCommand::create('SELECT', '1000');
|
||||
|
||||
$connection = $this->getMockBuilder(static::CONNECTION_CLASS)
|
||||
->setMethods(array('executeCommand', 'createResource'))
|
||||
->setConstructorArgs(array(new Parameters()))
|
||||
->getMock();
|
||||
|
||||
$connection->method('executeCommand')
|
||||
->with($cmdSelect)
|
||||
->will($this->returnValue(
|
||||
new ErrorResponse("ERR invalid DB index")
|
||||
));
|
||||
|
||||
$connection->method('createResource');
|
||||
|
||||
$connection->addConnectCommand($cmdSelect);
|
||||
$connection->connect();
|
||||
}
|
||||
|
||||
// ******************************************************************** //
|
||||
// ---- INTEGRATION TESTS --------------------------------------------- //
|
||||
// ******************************************************************** //
|
||||
|
||||
@@ -54,7 +54,6 @@ class PhpiredisSocketConnectionTest extends PredisConnectionTestCase
|
||||
public function testThrowsExceptionOnInitializationCommandFailure()
|
||||
{
|
||||
$cmdSelect = RawCommand::create('SELECT', '1000');
|
||||
$responseError =
|
||||
|
||||
$connection = $this->getMockBuilder(static::CONNECTION_CLASS)
|
||||
->setMethods(array('executeCommand', 'createResource'))
|
||||
|
||||
@@ -54,7 +54,6 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase
|
||||
public function testThrowsExceptionOnInitializationCommandFailure()
|
||||
{
|
||||
$cmdSelect = RawCommand::create('SELECT', '1000');
|
||||
$responseError =
|
||||
|
||||
$connection = $this->getMockBuilder(static::CONNECTION_CLASS)
|
||||
->setMethods(array('executeCommand', 'createResource'))
|
||||
|
||||
@@ -29,7 +29,6 @@ class StreamConnectionTest extends PredisConnectionTestCase
|
||||
public function testThrowsExceptionOnInitializationCommandFailure()
|
||||
{
|
||||
$cmdSelect = RawCommand::create('SELECT', '1000');
|
||||
$responseError =
|
||||
|
||||
$connection = $this->getMockBuilder(static::CONNECTION_CLASS)
|
||||
->setMethods(array('executeCommand', 'createResource'))
|
||||
|
||||
Reference in New Issue
Block a user