From cebdf889a4e71df321aa808c47517edb9f59b1fc Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Tue, 10 Dec 2013 22:14:34 +0100 Subject: [PATCH] Rename connection to Predis\Connection\PhpiredisSocketConnection. --- CHANGELOG.md | 4 ++++ README.md | 4 ++-- ...onnection.php => PhpiredisSocketConnection.php} | 2 +- ...nTest.php => PhpiredisSocketConnectionTest.php} | 14 +++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) rename lib/Predis/Connection/{PhpiredisConnection.php => PhpiredisSocketConnection.php} (99%) rename tests/Predis/Connection/{PhpiredisConnectionTest.php => PhpiredisSocketConnectionTest.php} (88%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0af2a44a..df37d16c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,10 @@ v0.9.0 (201x-xx-xx) renamed to `writeRequest()` for consistency with its counterpart, the method `readResponse()`. +- The connection based on ext-phpiredis and ext-socket has been renamed for the + sake of consistency to `Predis\Connection\PhpiredisSocketConnection`. The one + based on PHP's streams is still `Predis\Connection\PhpiredisStreamConnection`. + - The connection factory has been simplified and does not need anymore a profile to create `AUTH` and `SELECT` commands when connection parameters contain both `password` and `database`. Raw commands will be used instead. diff --git a/README.md b/README.md index 23636aa6..7c4d36bf 100644 --- a/README.md +++ b/README.md @@ -183,8 +183,8 @@ is based on socket resources provided by `ext-socket`. Both support TCP/IP or UN ```php $client = new Predis\Client('tcp://127.0.0.1', [ 'connections' => [ - 'tcp' => 'Predis\Connection\PhpiredisStreamConnection', // PHP streams - 'unix' => 'Predis\Connection\PhpiredisConnection', // ext-socket + 'tcp' => 'Predis\Connection\PhpiredisStreamConnection', // PHP streams + 'unix' => 'Predis\Connection\PhpiredisSocketConnection', // ext-socket ], ]); ``` diff --git a/lib/Predis/Connection/PhpiredisConnection.php b/lib/Predis/Connection/PhpiredisSocketConnection.php similarity index 99% rename from lib/Predis/Connection/PhpiredisConnection.php rename to lib/Predis/Connection/PhpiredisSocketConnection.php index 9a646ac4..500be19e 100644 --- a/lib/Predis/Connection/PhpiredisConnection.php +++ b/lib/Predis/Connection/PhpiredisSocketConnection.php @@ -40,7 +40,7 @@ use Predis\Response; * @link http://github.com/nrk/phpiredis * @author Daniele Alessandri */ -class PhpiredisConnection extends AbstractConnection +class PhpiredisSocketConnection extends AbstractConnection { private $reader; diff --git a/tests/Predis/Connection/PhpiredisConnectionTest.php b/tests/Predis/Connection/PhpiredisSocketConnectionTest.php similarity index 88% rename from tests/Predis/Connection/PhpiredisConnectionTest.php rename to tests/Predis/Connection/PhpiredisSocketConnectionTest.php index 8d65df68..ba39a73b 100644 --- a/tests/Predis/Connection/PhpiredisConnectionTest.php +++ b/tests/Predis/Connection/PhpiredisSocketConnectionTest.php @@ -14,14 +14,14 @@ namespace Predis\Connection; /** * @group ext-phpiredis */ -class PhpiredisConnectionTest extends PredisConnectionTestCase +class PhpiredisSocketConnectionTest extends PredisConnectionTestCase { /** * @group disconnected */ public function testConstructorDoesNotOpenConnection() { - $connection = new PhpiredisConnection($this->getParameters()); + $connection = new PhpiredisSocketConnection($this->getParameters()); $this->assertFalse($connection->isConnected()); } @@ -32,7 +32,7 @@ class PhpiredisConnectionTest extends PredisConnectionTestCase public function testExposesParameters() { $parameters = $this->getParameters(); - $connection = new PhpiredisConnection($parameters); + $connection = new PhpiredisSocketConnection($parameters); $this->assertSame($parameters, $connection->getParameters()); } @@ -45,7 +45,7 @@ class PhpiredisConnectionTest extends PredisConnectionTestCase public function testThrowsExceptionOnInvalidScheme() { $parameters = $this->getParameters(array('scheme' => 'udp')); - $connection = new PhpiredisConnection($parameters); + $connection = new PhpiredisSocketConnection($parameters); } /** @@ -54,11 +54,11 @@ class PhpiredisConnectionTest extends PredisConnectionTestCase public function testCanBeSerialized() { $parameters = $this->getParameters(array('alias' => 'redis', 'read_write_timeout' => 10)); - $connection = new PhpiredisConnection($parameters); + $connection = new PhpiredisSocketConnection($parameters); $unserialized = unserialize(serialize($connection)); - $this->assertInstanceOf('Predis\Connection\PhpiredisConnection', $unserialized); + $this->assertInstanceOf('Predis\Connection\PhpiredisSocketConnection', $unserialized); $this->assertEquals($parameters, $unserialized->getParameters()); } @@ -114,7 +114,7 @@ class PhpiredisConnectionTest extends PredisConnectionTestCase $parameters = $this->getParameters($parameters); $profile = $this->getProfile(); - $connection = new PhpiredisConnection($parameters); + $connection = new PhpiredisSocketConnection($parameters); if ($initialize) { $connection->pushInitCommand($profile->createCommand('select', array($parameters->database)));