mirror of
https://github.com/predis/predis.git
synced 2026-09-16 13:27:14 +00:00
Move some classes and interfaces in other namespaces.
This commit is contained in:
+5
-3
@@ -17,8 +17,6 @@ by the naming conventions adopted by the Symfony2 project. This is a list of all
|
||||
|
||||
- `Predis\IReplyObject` => `Predis\ResponseObjectInterface`
|
||||
- `Predis\IRedisServerError` => `Predis\ResponseErrorInterface`
|
||||
- `Predis\IConnectionFactory` => `Predis\ConnectionFactoryInterface`
|
||||
- `Predis\IConnectionParameters` => `Predis\ConnectionParametersInterface`
|
||||
- `Predis\Options\IOption` => `Predis\Option\OptionInterface`
|
||||
- `Predis\Options\IClientOptions` => `Predis\Option\ClientOptionsInterface`
|
||||
- `Predis\Profile\IServerProfile` => `Predis\Profile\ServerProfileInterface`
|
||||
@@ -48,4 +46,8 @@ by the naming conventions adopted by the Symfony2 project. This is a list of all
|
||||
|
||||
### Classes or interfaces moved to different namespaces ###
|
||||
|
||||
- `Predis\MonitorContext` is now under the `Predis\Monitor`.
|
||||
- `Predis\MonitorContext` => `Predis\Monitor\MonitorContext`
|
||||
- `Predis\ConnectionParameters` => `Predis\Connection\ConnectionParameters`
|
||||
- `Predis\ConnectionParametersInterface` => `Predis\Connection\ConnectionParametersInterface`
|
||||
- `Predis\ConnectionFactory` => `Predis\Connection\ConnectionFactory`
|
||||
- `Predis\ConnectionFactoryInterface` => `Predis\Connection\ConnectionFactoryInterface`
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
require 'SharedConfigurations.php';
|
||||
|
||||
use Predis\ConnectionParameters;
|
||||
use Predis\Command\CommandInterface;
|
||||
use Predis\Connection\StreamConnection;
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ use Predis\Command\CommandInterface;
|
||||
use Predis\Option\ClientOptionsInterface;
|
||||
use Predis\Connection\ConnectionInterface;
|
||||
use Predis\Connection\AggregatedConnectionInterface;
|
||||
use Predis\Connection\ConnectionFactory;
|
||||
use Predis\Connection\ConnectionFactoryInterface;
|
||||
use Predis\Profile\ServerProfileInterface;
|
||||
use Predis\Option\ClientOptions;
|
||||
use Predis\Profile\ServerProfile;
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Predis\Connection;
|
||||
|
||||
use Predis\Helpers;
|
||||
use Predis\ResponseObjectInterface;
|
||||
use Predis\ConnectionParametersInterface;
|
||||
use Predis\ClientException;
|
||||
use Predis\NotSupportedException;
|
||||
use Predis\Command\CommandInterface;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Predis\Connection;
|
||||
|
||||
use Predis\ConnectionParametersInterface;
|
||||
use Predis\Command\CommandInterface;
|
||||
use Predis\Protocol\ProtocolInterface;
|
||||
use Predis\Protocol\Text\TextProtocol;
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis;
|
||||
namespace Predis\Connection;
|
||||
|
||||
use Predis\Profile\ServerProfileInterface;
|
||||
use Predis\Connection\SingleConnectionInterface;
|
||||
use Predis\Connection\AggregatedConnectionInterface;
|
||||
use Predis\Profile\ServerProfile;
|
||||
|
||||
/**
|
||||
+1
-2
@@ -9,10 +9,9 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis;
|
||||
namespace Predis\Connection;
|
||||
|
||||
use Predis\Profile\ServerProfileInterface;
|
||||
use Predis\Connection\AggregatedConnectionInterface;
|
||||
|
||||
/**
|
||||
* Interface that must be implemented by classes that provide their own mechanism
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis;
|
||||
namespace Predis\Connection;
|
||||
|
||||
use Predis\Option\OptionInterface;
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis;
|
||||
namespace Predis\Connection;
|
||||
|
||||
/**
|
||||
* Interface that must be implemented by classes that provide their own mechanism
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace Predis\Connection;
|
||||
|
||||
use Predis\Command\CommandInterface;
|
||||
use Predis\ConnectionParametersInterface;
|
||||
use Predis\ResponseError;
|
||||
use Predis\ResponseQueued;
|
||||
use Predis\ClientException;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace Predis\Connection;
|
||||
|
||||
use Predis\ResponseErrorInterface;
|
||||
use Predis\ConnectionFactoryInterface;
|
||||
use Predis\Command\CommandInterface;
|
||||
use Predis\ClientException;
|
||||
use Predis\NotSupportedException;
|
||||
@@ -31,9 +30,9 @@ class RedisCluster implements ClusterConnectionInterface, \IteratorAggregate, \C
|
||||
private $hashgenerator;
|
||||
|
||||
/**
|
||||
* @param ConnectionFactoryInterface $connections Connection factory object.
|
||||
* @param FactoryInterface $connections Connection factory object.
|
||||
*/
|
||||
public function __construct(ConnectionFactoryInterface $connections = null)
|
||||
public function __construct(FactoryInterface $connections = null)
|
||||
{
|
||||
$this->pool = array();
|
||||
$this->slots = array();
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Predis\Connection;
|
||||
use Predis\ResponseError;
|
||||
use Predis\ResponseQueued;
|
||||
use Predis\NotSupportedException;
|
||||
use Predis\ConnectionParametersInterface;
|
||||
use Predis\Command\CommandInterface;
|
||||
use Predis\Iterator\MultiBulkResponseSimple;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Predis\Connection;
|
||||
|
||||
use Predis\Command\CommandInterface;
|
||||
use Predis\ResponseObjectInterface;
|
||||
use Predis\ConnectionParametersInterface;
|
||||
use Predis\ResponseError;
|
||||
use Predis\NotSupportedException;
|
||||
use Predis\Protocol\ProtocolException;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Predis\Option;
|
||||
|
||||
use Predis\ConnectionFactoryInterface;
|
||||
use Predis\ConnectionFactory;
|
||||
use Predis\Connection\ConnectionFactory;
|
||||
use Predis\Connection\ConnectionFactoryInterface;
|
||||
|
||||
/**
|
||||
* Option class that returns a connection factory to be used by a client.
|
||||
@@ -38,7 +38,7 @@ class ClientConnectionFactory extends AbstractOption
|
||||
}
|
||||
if (is_string($value) && class_exists($value)) {
|
||||
if (!($factory = new $value()) && !$factory instanceof ConnectionFactoryInterface) {
|
||||
throw new \InvalidArgumentException("Class $value must be an instance of Predis\ConnectionFactoryInterface");
|
||||
throw new \InvalidArgumentException("Class $value must be an instance of Predis\Connection\ConnectionFactoryInterface");
|
||||
}
|
||||
return $factory;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Predis\Connection;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
use Predis\ConnectionParameters;
|
||||
use Predis\Profile\ServerProfile;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@ use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
use Predis\Profile\ServerProfile;
|
||||
use Predis\Connection\PredisCluster;
|
||||
use Predis\Connection\MasterSlaveReplication;
|
||||
use Predis\Connection\ConnectionFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -201,7 +202,7 @@ class ClientTest extends StandardTestCase
|
||||
*/
|
||||
public function testConstructorWithNullAndArrayArgument()
|
||||
{
|
||||
$factory = $this->getMock('Predis\ConnectionFactoryInterface');
|
||||
$factory = $this->getMock('Predis\Connection\ConnectionFactoryInterface');
|
||||
|
||||
$arg2 = array('profile' => '2.0', 'prefix' => 'prefix:', 'connections' => $factory);
|
||||
$client = new Client(null, $arg2);
|
||||
|
||||
+7
-7
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis;
|
||||
namespace Predis\Connection;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
@@ -25,7 +25,7 @@ class ConnectionFactoryTest extends StandardTestCase
|
||||
{
|
||||
$factory = new ConnectionFactory();
|
||||
|
||||
$this->assertInstanceOf('Predis\ConnectionFactoryInterface', $factory);
|
||||
$this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $factory);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,7 +275,7 @@ class ConnectionFactoryTest extends StandardTestCase
|
||||
->method('add')
|
||||
->with($this->isInstanceOf('Predis\Connection\SingleConnectionInterface'));
|
||||
|
||||
$factory = $this->getMock('Predis\ConnectionFactory', array('create'));
|
||||
$factory = $this->getMock('Predis\Connection\ConnectionFactory', array('create'));
|
||||
$factory->expects($this->never())
|
||||
->method('create');
|
||||
|
||||
@@ -285,7 +285,7 @@ class ConnectionFactoryTest extends StandardTestCase
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testAggregatedConnectionWithMixedConnectionParameters()
|
||||
public function testAggregatedConnectionWithMixedParameters()
|
||||
{
|
||||
list(, $connectionClass) = $this->getMockConnectionClass();
|
||||
|
||||
@@ -294,7 +294,7 @@ class ConnectionFactoryTest extends StandardTestCase
|
||||
->method('add')
|
||||
->with($this->isInstanceOf('Predis\Connection\SingleConnectionInterface'));
|
||||
|
||||
$factory = $this->getMock('Predis\ConnectionFactory', array('create'));
|
||||
$factory = $this->getMock('Predis\Connection\ConnectionFactory', array('create'));
|
||||
$factory->expects($this->exactly(3))
|
||||
->method('create')
|
||||
->will($this->returnCallback(function($_, $_) use($connectionClass) {
|
||||
@@ -312,7 +312,7 @@ class ConnectionFactoryTest extends StandardTestCase
|
||||
$cluster = $this->getMock('Predis\Connection\ClusterConnectionInterface');
|
||||
$cluster->expects($this->never())->method('add');
|
||||
|
||||
$factory = $this->getMock('Predis\ConnectionFactory', array('create'));
|
||||
$factory = $this->getMock('Predis\Connection\ConnectionFactory', array('create'));
|
||||
$factory->expects($this->never())->method('create');
|
||||
|
||||
$factory->createAggregated($cluster, array());
|
||||
@@ -329,7 +329,7 @@ class ConnectionFactoryTest extends StandardTestCase
|
||||
$cluster = $this->getMock('Predis\Connection\ClusterConnectionInterface');
|
||||
$profile = $this->getMock('Predis\Profile\ServerProfileInterface');
|
||||
|
||||
$factory = $this->getMock('Predis\ConnectionFactory', array('create'));
|
||||
$factory = $this->getMock('Predis\Connection\ConnectionFactory', array('create'));
|
||||
$factory->expects($this->exactly(2))
|
||||
->method('create')
|
||||
->with($this->anything(), $profile)
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Predis;
|
||||
namespace Predis\Connection;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
@@ -17,7 +17,7 @@ use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
* @todo ConnectionParameters::define();
|
||||
* @todo ConnectionParameters::undefine();
|
||||
*/
|
||||
class ConnectionParametersTest extends StandardTestCase
|
||||
class ParametersTest extends StandardTestCase
|
||||
{
|
||||
/**
|
||||
* @group disconnected
|
||||
@@ -13,7 +13,6 @@ namespace Predis\Connection;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
use Predis\ConnectionParameters;
|
||||
use Predis\Profile\ServerProfile;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Predis\Connection;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
use Predis\ConnectionParameters;
|
||||
use Predis\Profile\ServerProfile;
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,7 @@ class PhpiredisConnectionTest extends ConnectionTestCase
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testExposesConnectionParameters()
|
||||
public function testExposesParameters()
|
||||
{
|
||||
$parameters = $this->getParameters();
|
||||
$connection = new PhpiredisConnection($parameters);
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Predis\Connection;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
use Predis\ConnectionParameters;
|
||||
use Predis\Profile\ServerProfile;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Predis\Connection;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
use Predis\ConnectionParameters;
|
||||
use Predis\Profile\ServerProfile;
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,7 @@ class StreamConnectionTest extends ConnectionTestCase
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testExposesConnectionParameters()
|
||||
public function testExposesParameters()
|
||||
{
|
||||
$parameters = $this->getParameters();
|
||||
$connection = new StreamConnection($parameters);
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Predis\Connection;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
use Predis\ConnectionParameters;
|
||||
use Predis\Profile\ServerProfile;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Predis\Option;
|
||||
|
||||
use \PHPUnit_Framework_TestCase as StandardTestCase;
|
||||
|
||||
use Predis\ConnectionFactory;
|
||||
use Predis\Connection\ConnectionFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,7 +30,7 @@ class ClientConnectionFactoryTest extends StandardTestCase
|
||||
|
||||
$options = $this->getMock('Predis\Option\ClientOptionsInterface');
|
||||
|
||||
$default = $this->getMock('Predis\ConnectionFactoryInterface');
|
||||
$default = $this->getMock('Predis\Connection\ConnectionFactoryInterface');
|
||||
$default->expects($this->exactly(2))
|
||||
->method('define')
|
||||
->with($this->matchesRegularExpression('/^tcp|redis$/'), $connectionClass);
|
||||
@@ -43,7 +43,7 @@ class ClientConnectionFactoryTest extends StandardTestCase
|
||||
|
||||
$factory = $option->filter($options, $value);
|
||||
|
||||
$this->assertInstanceOf('Predis\ConnectionFactoryInterface', $factory);
|
||||
$this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $factory);
|
||||
$this->assertSame($default, $factory);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class ClientConnectionFactoryTest extends StandardTestCase
|
||||
*/
|
||||
public function testValidationAcceptsFactoryInstancesAsValue()
|
||||
{
|
||||
$value = $this->getMock('Predis\ConnectionFactoryInterface');
|
||||
$value = $this->getMock('Predis\Connection\ConnectionFactoryInterface');
|
||||
$options = $this->getMock('Predis\Option\ClientOptionsInterface');
|
||||
|
||||
$option = $this->getMock('Predis\Option\ClientConnectionFactory', array('getDefault'));
|
||||
@@ -66,7 +66,7 @@ class ClientConnectionFactoryTest extends StandardTestCase
|
||||
*/
|
||||
public function testValidationAcceptsStringAsValue()
|
||||
{
|
||||
$factory = 'Predis\ConnectionFactory';
|
||||
$factory = 'Predis\Connection\ConnectionFactory';
|
||||
$options = $this->getMock('Predis\Option\ClientOptionsInterface');
|
||||
|
||||
$option = $this->getMock('Predis\Option\ClientConnectionFactory', array('getDefault'));
|
||||
@@ -93,7 +93,7 @@ class ClientConnectionFactoryTest extends StandardTestCase
|
||||
*/
|
||||
public function testInvokeReturnsSpecifiedFactoryOrDefault()
|
||||
{
|
||||
$value = $this->getMock('Predis\ConnectionFactoryInterface');
|
||||
$value = $this->getMock('Predis\Connection\ConnectionFactoryInterface');
|
||||
$options = $this->getMock('Predis\Option\ClientOptionsInterface');
|
||||
|
||||
$option = $this->getMock('Predis\Option\ClientConnectionFactory', array('filter', 'getDefault'));
|
||||
@@ -103,7 +103,7 @@ class ClientConnectionFactoryTest extends StandardTestCase
|
||||
->will($this->returnValue($value));
|
||||
$option->expects($this->never())->method('getDefault');
|
||||
|
||||
$this->assertInstanceOf('Predis\ConnectionFactoryInterface', $option($options, $value));
|
||||
$this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $option($options, $value));
|
||||
|
||||
$option = $this->getMock('Predis\Option\ClientConnectionFactory', array('filter', 'getDefault'));
|
||||
$option->expects($this->never())->method('filter');
|
||||
@@ -112,6 +112,6 @@ class ClientConnectionFactoryTest extends StandardTestCase
|
||||
->with($options)
|
||||
->will($this->returnValue($value));
|
||||
|
||||
$this->assertInstanceOf('Predis\ConnectionFactoryInterface', $option($options, null));
|
||||
$this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $option($options, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class ClientOptionsTest extends StandardTestCase
|
||||
{
|
||||
$options = new ClientOptions();
|
||||
|
||||
$this->assertInstanceOf('Predis\ConnectionFactoryInterface', $options->connections);
|
||||
$this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $options->connections);
|
||||
$this->assertInstanceOf('Predis\Profile\ServerProfileInterface', $options->profile);
|
||||
$this->assertInstanceOf('Predis\Connection\ClusterConnectionInterface', $options->cluster);
|
||||
$this->assertNull($options->prefix);
|
||||
@@ -39,13 +39,13 @@ class ClientOptionsTest extends StandardTestCase
|
||||
{
|
||||
$options = new ClientOptions(array(
|
||||
'cluster' => 'Predis\Connection\PredisCluster',
|
||||
'connections' => 'Predis\ConnectionFactory',
|
||||
'connections' => 'Predis\Connection\ConnectionFactory',
|
||||
'prefix' => 'prefix:',
|
||||
'profile' => '2.0',
|
||||
'exceptions' => false,
|
||||
));
|
||||
|
||||
$this->assertInstanceOf('Predis\ConnectionFactoryInterface', $options->connections);
|
||||
$this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $options->connections);
|
||||
$this->assertInstanceOf('Predis\Profile\ServerProfileInterface', $options->profile);
|
||||
$this->assertInstanceOf('Predis\Connection\ClusterConnectionInterface', $options->cluster);
|
||||
$this->assertInstanceOf('Predis\Command\Processor\CommandProcessorInterface', $options->prefix);
|
||||
|
||||
Reference in New Issue
Block a user