Permalink
Browse files

Move some classes and interfaces in other namespaces.

  • Loading branch information...
1 parent 28e1e7a commit 559853bdd5a7c7c40b657d0ab5147100f046f8dc @nrk committed Jul 26, 2012
View
@@ -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;
View
@@ -15,6 +15,8 @@
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 @@
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;
/**
@@ -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
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Predis;
+namespace Predis\Connection;
use Predis\Option\OptionInterface;
@@ -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 @@
use Predis\ResponseError;
use Predis\ResponseQueued;
use Predis\NotSupportedException;
-use Predis\ConnectionParametersInterface;
use Predis\Command\CommandInterface;
use Predis\Iterator\MultiBulkResponseSimple;
@@ -13,7 +13,6 @@
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 @@ public function filter(ClientOptionsInterface $options, $value)
}
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 @@
use \PHPUnit_Framework_TestCase as StandardTestCase;
-use Predis\ConnectionParameters;
use Predis\Profile\ServerProfile;
/**
@@ -16,6 +16,7 @@
use Predis\Profile\ServerProfile;
use Predis\Connection\PredisCluster;
use Predis\Connection\MasterSlaveReplication;
+use Predis\Connection\ConnectionFactory;
/**
*
@@ -201,7 +202,7 @@ public function testConstructorWithReplicationArgument()
*/
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);
@@ -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 @@ public function testImplementsCorrectInterface()
{
$factory = new ConnectionFactory();
- $this->assertInstanceOf('Predis\ConnectionFactoryInterface', $factory);
+ $this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $factory);
}
/**
@@ -275,7 +275,7 @@ public function testAggregatedConnectionSkipCreationOnConnectionInstance()
->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 @@ public function testAggregatedConnectionSkipCreationOnConnectionInstance()
/**
* @group disconnected
*/
- public function testAggregatedConnectionWithMixedConnectionParameters()
+ public function testAggregatedConnectionWithMixedParameters()
{
list(, $connectionClass) = $this->getMockConnectionClass();
@@ -294,7 +294,7 @@ public function testAggregatedConnectionWithMixedConnectionParameters()
->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 @@ public function testAggregatedConnectionWithEmptyListOfParameters()
$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 @@ public function testAggregatedConnectionWithServerProfileArgument()
$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)
@@ -9,15 +9,15 @@
* file that was distributed with this source code.
*/
-namespace Predis;
+namespace Predis\Connection;
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 @@
use \PHPUnit_Framework_TestCase as StandardTestCase;
-use Predis\ConnectionParameters;
use Predis\Profile\ServerProfile;
/**
@@ -13,7 +13,6 @@
use \PHPUnit_Framework_TestCase as StandardTestCase;
-use Predis\ConnectionParameters;
use Predis\Profile\ServerProfile;
/**
@@ -34,7 +33,7 @@ public function testConstructorDoesNotOpenConnection()
/**
* @group disconnected
*/
- public function testExposesConnectionParameters()
+ public function testExposesParameters()
{
$parameters = $this->getParameters();
$connection = new PhpiredisConnection($parameters);
@@ -13,7 +13,6 @@
use \PHPUnit_Framework_TestCase as StandardTestCase;
-use Predis\ConnectionParameters;
use Predis\Profile\ServerProfile;
/**
@@ -13,7 +13,6 @@
use \PHPUnit_Framework_TestCase as StandardTestCase;
-use Predis\ConnectionParameters;
use Predis\Profile\ServerProfile;
/**
@@ -34,7 +33,7 @@ public function testConstructorDoesNotOpenConnection()
/**
* @group disconnected
*/
- public function testExposesConnectionParameters()
+ public function testExposesParameters()
{
$parameters = $this->getParameters();
$connection = new StreamConnection($parameters);
@@ -13,7 +13,6 @@
use \PHPUnit_Framework_TestCase as StandardTestCase;
-use Predis\ConnectionParameters;
use Predis\Profile\ServerProfile;
/**
@@ -13,7 +13,7 @@
use \PHPUnit_Framework_TestCase as StandardTestCase;
-use Predis\ConnectionFactory;
+use Predis\Connection\ConnectionFactory;
/**
*
@@ -30,7 +30,7 @@ public function testValidationReturnsDefaultFactoryWithSchemeDefinitionsArray()
$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 @@ public function testValidationReturnsDefaultFactoryWithSchemeDefinitionsArray()
$factory = $option->filter($options, $value);
- $this->assertInstanceOf('Predis\ConnectionFactoryInterface', $factory);
+ $this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $factory);
$this->assertSame($default, $factory);
}
@@ -52,7 +52,7 @@ public function testValidationReturnsDefaultFactoryWithSchemeDefinitionsArray()
*/
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 @@ public function testValidationAcceptsFactoryInstancesAsValue()
*/
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 @@ public function testValidationThrowsExceptionOnWrongInvalidArguments()
*/
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 @@ public function testInvokeReturnsSpecifiedFactoryOrDefault()
->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 @@ public function testInvokeReturnsSpecifiedFactoryOrDefault()
->with($options)
->will($this->returnValue($value));
- $this->assertInstanceOf('Predis\ConnectionFactoryInterface', $option($options, null));
+ $this->assertInstanceOf('Predis\Connection\ConnectionFactoryInterface', $option($options, null));
}
}
Oops, something went wrong.

0 comments on commit 559853b

Please sign in to comment.