diff --git a/CHANGELOG.NAMING.md b/CHANGELOG.NAMING.md index b17042cc..2edcaa2c 100644 --- a/CHANGELOG.NAMING.md +++ b/CHANGELOG.NAMING.md @@ -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` diff --git a/examples/SimpleDebuggableConnection.php b/examples/SimpleDebuggableConnection.php index 24738929..0d9e4b54 100644 --- a/examples/SimpleDebuggableConnection.php +++ b/examples/SimpleDebuggableConnection.php @@ -11,7 +11,6 @@ require 'SharedConfigurations.php'; -use Predis\ConnectionParameters; use Predis\Command\CommandInterface; use Predis\Connection\StreamConnection; diff --git a/lib/Predis/Client.php b/lib/Predis/Client.php index 41e7610c..051fe6cc 100644 --- a/lib/Predis/Client.php +++ b/lib/Predis/Client.php @@ -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; diff --git a/lib/Predis/Connection/AbstractConnection.php b/lib/Predis/Connection/AbstractConnection.php index a55618fd..99e197d5 100644 --- a/lib/Predis/Connection/AbstractConnection.php +++ b/lib/Predis/Connection/AbstractConnection.php @@ -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; diff --git a/lib/Predis/Connection/ComposableStreamConnection.php b/lib/Predis/Connection/ComposableStreamConnection.php index a7b5f8c0..12fb86c6 100644 --- a/lib/Predis/Connection/ComposableStreamConnection.php +++ b/lib/Predis/Connection/ComposableStreamConnection.php @@ -11,7 +11,6 @@ namespace Predis\Connection; -use Predis\ConnectionParametersInterface; use Predis\Command\CommandInterface; use Predis\Protocol\ProtocolInterface; use Predis\Protocol\Text\TextProtocol; diff --git a/lib/Predis/ConnectionFactory.php b/lib/Predis/Connection/ConnectionFactory.php similarity index 97% rename from lib/Predis/ConnectionFactory.php rename to lib/Predis/Connection/ConnectionFactory.php index 862bbbf8..23093c8c 100644 --- a/lib/Predis/ConnectionFactory.php +++ b/lib/Predis/Connection/ConnectionFactory.php @@ -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; /** diff --git a/lib/Predis/ConnectionFactoryInterface.php b/lib/Predis/Connection/ConnectionFactoryInterface.php similarity index 96% rename from lib/Predis/ConnectionFactoryInterface.php rename to lib/Predis/Connection/ConnectionFactoryInterface.php index 5b5baaa9..d763413f 100644 --- a/lib/Predis/ConnectionFactoryInterface.php +++ b/lib/Predis/Connection/ConnectionFactoryInterface.php @@ -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 diff --git a/lib/Predis/ConnectionParameters.php b/lib/Predis/Connection/ConnectionParameters.php similarity index 99% rename from lib/Predis/ConnectionParameters.php rename to lib/Predis/Connection/ConnectionParameters.php index 829ed33d..d863ca99 100644 --- a/lib/Predis/ConnectionParameters.php +++ b/lib/Predis/Connection/ConnectionParameters.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis; +namespace Predis\Connection; use Predis\Option\OptionInterface; diff --git a/lib/Predis/ConnectionParametersInterface.php b/lib/Predis/Connection/ConnectionParametersInterface.php similarity index 97% rename from lib/Predis/ConnectionParametersInterface.php rename to lib/Predis/Connection/ConnectionParametersInterface.php index a6d8818c..3e3cb380 100644 --- a/lib/Predis/ConnectionParametersInterface.php +++ b/lib/Predis/Connection/ConnectionParametersInterface.php @@ -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 diff --git a/lib/Predis/Connection/PhpiredisConnection.php b/lib/Predis/Connection/PhpiredisConnection.php index 078f7f9d..b245e723 100644 --- a/lib/Predis/Connection/PhpiredisConnection.php +++ b/lib/Predis/Connection/PhpiredisConnection.php @@ -12,7 +12,6 @@ namespace Predis\Connection; use Predis\Command\CommandInterface; -use Predis\ConnectionParametersInterface; use Predis\ResponseError; use Predis\ResponseQueued; use Predis\ClientException; diff --git a/lib/Predis/Connection/RedisCluster.php b/lib/Predis/Connection/RedisCluster.php index 832458c8..2120d241 100644 --- a/lib/Predis/Connection/RedisCluster.php +++ b/lib/Predis/Connection/RedisCluster.php @@ -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(); diff --git a/lib/Predis/Connection/StreamConnection.php b/lib/Predis/Connection/StreamConnection.php index 2185e3f3..969bfb9e 100644 --- a/lib/Predis/Connection/StreamConnection.php +++ b/lib/Predis/Connection/StreamConnection.php @@ -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; diff --git a/lib/Predis/Connection/WebdisConnection.php b/lib/Predis/Connection/WebdisConnection.php index 5d0b6778..85e436c8 100644 --- a/lib/Predis/Connection/WebdisConnection.php +++ b/lib/Predis/Connection/WebdisConnection.php @@ -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; diff --git a/lib/Predis/Option/ClientConnectionFactory.php b/lib/Predis/Option/ClientConnectionFactory.php index 742b90fb..841f2119 100644 --- a/lib/Predis/Option/ClientConnectionFactory.php +++ b/lib/Predis/Option/ClientConnectionFactory.php @@ -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; } diff --git a/tests/PHPUnit/ConnectionTestCase.php b/tests/PHPUnit/ConnectionTestCase.php index 03a61829..431b979b 100644 --- a/tests/PHPUnit/ConnectionTestCase.php +++ b/tests/PHPUnit/ConnectionTestCase.php @@ -13,7 +13,6 @@ namespace Predis\Connection; use \PHPUnit_Framework_TestCase as StandardTestCase; -use Predis\ConnectionParameters; use Predis\Profile\ServerProfile; /** diff --git a/tests/Predis/ClientTest.php b/tests/Predis/ClientTest.php index 7e455f2f..bbcba5fd 100644 --- a/tests/Predis/ClientTest.php +++ b/tests/Predis/ClientTest.php @@ -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); diff --git a/tests/Predis/ConnectionFactoryTest.php b/tests/Predis/Connection/ConnectionFactoryTest.php similarity index 95% rename from tests/Predis/ConnectionFactoryTest.php rename to tests/Predis/Connection/ConnectionFactoryTest.php index 27820d77..a8f3620b 100644 --- a/tests/Predis/ConnectionFactoryTest.php +++ b/tests/Predis/Connection/ConnectionFactoryTest.php @@ -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) diff --git a/tests/Predis/ConnectionParametersTest.php b/tests/Predis/Connection/ConnectionParametersTest.php similarity index 98% rename from tests/Predis/ConnectionParametersTest.php rename to tests/Predis/Connection/ConnectionParametersTest.php index d9e9de01..e0ff2a69 100644 --- a/tests/Predis/ConnectionParametersTest.php +++ b/tests/Predis/Connection/ConnectionParametersTest.php @@ -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 diff --git a/tests/Predis/Connection/MasterSlaveReplicationTest.php b/tests/Predis/Connection/MasterSlaveReplicationTest.php index f0ab530a..c6221fb2 100644 --- a/tests/Predis/Connection/MasterSlaveReplicationTest.php +++ b/tests/Predis/Connection/MasterSlaveReplicationTest.php @@ -13,7 +13,6 @@ namespace Predis\Connection; use \PHPUnit_Framework_TestCase as StandardTestCase; -use Predis\ConnectionParameters; use Predis\Profile\ServerProfile; /** diff --git a/tests/Predis/Connection/PhpiredisConnectionTest.php b/tests/Predis/Connection/PhpiredisConnectionTest.php index 996c18fc..8a29e644 100644 --- a/tests/Predis/Connection/PhpiredisConnectionTest.php +++ b/tests/Predis/Connection/PhpiredisConnectionTest.php @@ -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); diff --git a/tests/Predis/Connection/PredisClusterTest.php b/tests/Predis/Connection/PredisClusterTest.php index a9c7093f..3ccfb071 100644 --- a/tests/Predis/Connection/PredisClusterTest.php +++ b/tests/Predis/Connection/PredisClusterTest.php @@ -13,7 +13,6 @@ namespace Predis\Connection; use \PHPUnit_Framework_TestCase as StandardTestCase; -use Predis\ConnectionParameters; use Predis\Profile\ServerProfile; /** diff --git a/tests/Predis/Connection/StreamConnectionTest.php b/tests/Predis/Connection/StreamConnectionTest.php index ab0ad07d..a080a789 100644 --- a/tests/Predis/Connection/StreamConnectionTest.php +++ b/tests/Predis/Connection/StreamConnectionTest.php @@ -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); diff --git a/tests/Predis/Connection/WebdisConnectionTest.php b/tests/Predis/Connection/WebdisConnectionTest.php index 9b9e9a06..2fc7b853 100644 --- a/tests/Predis/Connection/WebdisConnectionTest.php +++ b/tests/Predis/Connection/WebdisConnectionTest.php @@ -13,7 +13,6 @@ namespace Predis\Connection; use \PHPUnit_Framework_TestCase as StandardTestCase; -use Predis\ConnectionParameters; use Predis\Profile\ServerProfile; /** diff --git a/tests/Predis/Option/ClientConnectionFactoryTest.php b/tests/Predis/Option/ClientConnectionFactoryTest.php index 449436c6..5bb700a5 100644 --- a/tests/Predis/Option/ClientConnectionFactoryTest.php +++ b/tests/Predis/Option/ClientConnectionFactoryTest.php @@ -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)); } } diff --git a/tests/Predis/Option/ClientOptionsTest.php b/tests/Predis/Option/ClientOptionsTest.php index 17bdfad8..0a124700 100644 --- a/tests/Predis/Option/ClientOptionsTest.php +++ b/tests/Predis/Option/ClientOptionsTest.php @@ -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);