Browse Source

Run php-cs against test suite.

Daniele Alessandri 11 years ago
parent
commit
2a6409590c
29 changed files with 68 additions and 75 deletions
  1. 1 1
      tests/PHPUnit/ArrayHasSameValuesConstraint.php
  2. 4 4
      tests/PHPUnit/PredisCommandTestCase.php
  3. 4 4
      tests/PHPUnit/PredisConnectionTestCase.php
  4. 4 4
      tests/PHPUnit/PredisDistributorTestCase.php
  5. 3 3
      tests/PHPUnit/PredisProfileTestCase.php
  6. 17 17
      tests/PHPUnit/PredisTestCase.php
  7. 1 1
      tests/PHPUnit/RedisCommandConstraint.php
  8. 1 1
      tests/Predis/ClientTest.php
  9. 1 1
      tests/Predis/Cluster/PredisStrategyTest.php
  10. 1 1
      tests/Predis/Cluster/RedisStrategyTest.php
  11. 2 2
      tests/Predis/Command/KeySortTest.php
  12. 1 1
      tests/Predis/Command/Processor/KeyPrefixProcessorTest.php
  13. 0 1
      tests/Predis/Command/ScriptCommandTest.php
  14. 4 4
      tests/Predis/Command/ZSetScanTest.php
  15. 6 6
      tests/Predis/CommunicationExceptionTest.php
  16. 0 1
      tests/Predis/Configuration/ClusterOptionTest.php
  17. 0 1
      tests/Predis/Connection/FactoryTest.php
  18. 2 1
      tests/Predis/Connection/MasterSlaveReplicationTest.php
  19. 1 1
      tests/Predis/Connection/ParametersTest.php
  20. 1 1
      tests/Predis/Connection/PredisClusterTest.php
  21. 1 2
      tests/Predis/Connection/RedisClusterTest.php
  22. 1 1
      tests/Predis/Connection/WebdisConnectionTest.php
  23. 0 1
      tests/Predis/Pipeline/AtomicTest.php
  24. 0 1
      tests/Predis/Pipeline/FireAndForgetTest.php
  25. 2 2
      tests/Predis/Pipeline/PipelineTest.php
  26. 0 1
      tests/Predis/Profile/FactoryTest.php
  27. 0 1
      tests/Predis/Protocol/Text/ProtocolProcessorTest.php
  28. 1 3
      tests/Predis/Replication/ReplicationStrategyTest.php
  29. 9 7
      tests/Predis/Transaction/MultiExecTest.php

+ 1 - 1
tests/PHPUnit/ArrayHasSameValuesConstraint.php

@@ -55,4 +55,4 @@ class ArrayHasSameValuesConstraint extends PHPUnit_Framework_Constraint
     {
         return $this->toString();
     }
-}
+}

+ 4 - 4
tests/PHPUnit/PredisCommandTestCase.php

@@ -25,14 +25,14 @@ abstract class PredisCommandTestCase extends PredisTestCase
      *
      * @return CommandInterface|string Instance or FQN of the expected command.
      */
-    protected abstract function getExpectedCommand();
+    abstract protected function getExpectedCommand();
 
     /**
      * Returns the expected command ID.
      *
      * @return string
      */
-    protected abstract function getExpectedId();
+    abstract protected function getExpectedId();
 
     /**
      * Returns a new command instance.
@@ -49,7 +49,7 @@ abstract class PredisCommandTestCase extends PredisTestCase
     /**
      * Returns a new client instance.
      *
-     * @param bool $connect Flush selected database before returning the client.
+     * @param  bool   $connect Flush selected database before returning the client.
      * @return Client
      */
     public function getClient($flushdb = true)
@@ -91,7 +91,7 @@ abstract class PredisCommandTestCase extends PredisTestCase
     /**
      * Returns a new command instance with the specified arguments.
      *
-     * @param array $arguments Arguments for the command.
+     * @param  array            $arguments Arguments for the command.
      * @return CommandInterface
      */
     protected function getCommandWithArgumentsArray(array $arguments)

+ 4 - 4
tests/PHPUnit/PredisConnectionTestCase.php

@@ -326,10 +326,10 @@ abstract class PredisConnectionTestCase extends PredisTestCase
     /**
      * Returns a new instance of a connection instance.
      *
-     * @param Profile\ProfileInterface $profile Reference to the server profile instance.
-     * @param Boolean $initialize Push default initialization commands (SELECT and FLUSHDB).
-     * @param array $parameters Additional connection parameters.
+     * @param  Profile\ProfileInterface $profile    Reference to the server profile instance.
+     * @param  Boolean                  $initialize Push default initialization commands (SELECT and FLUSHDB).
+     * @param  array                    $parameters Additional connection parameters.
      * @return StreamConnection
      */
-    protected abstract function getConnection(&$profile = null, $initialize = false, array $parameters = array());
+    abstract protected function getConnection(&$profile = null, $initialize = false, array $parameters = array());
 }

+ 4 - 4
tests/PHPUnit/PredisDistributorTestCase.php

@@ -23,14 +23,14 @@ abstract class PredisDistributorTestCase extends PredisTestCase
      *
      * @return Predis\Cluster\Distributor\DistributorInterface
      */
-    protected abstract function getDistributorInstance();
+    abstract protected function getDistributorInstance();
 
     /**
      * Returns a list of nodes from the hashring.
      *
-     * @param DistributorInterface $ring Hashring instance.
-     * @param int $iterations Number of nodes to fetch.
-     * @return array Nodes from the hashring.
+     * @param  DistributorInterface $ring       Hashring instance.
+     * @param  int                  $iterations Number of nodes to fetch.
+     * @return array                Nodes from the hashring.
      */
     protected function getNodes(DistributorInterface $ring, $iterations = 10)
     {

+ 3 - 3
tests/PHPUnit/PredisProfileTestCase.php

@@ -34,20 +34,20 @@ abstract class PredisProfileTestCase extends PredisTestCase
      *
      * @return string Version string.
      */
-    protected abstract function getExpectedVersion();
+    abstract protected function getExpectedVersion();
 
     /**
      * Returns the expected list of commands supported by the tested profile.
      *
      * @return array List of supported commands.
      */
-    protected abstract function getExpectedCommands();
+    abstract protected function getExpectedCommands();
 
     /**
      * Returns the list of commands supported by the current
      * server profile.
      *
-     * @param ProfileInterface $profile Server profile instance.
+     * @param  ProfileInterface $profile Server profile instance.
      * @return array
      */
     protected function getCommands(ProfileInterface $profile)

+ 17 - 17
tests/PHPUnit/PredisTestCase.php

@@ -23,8 +23,8 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
      * Verifies that a Redis command is a valid Predis\Command\CommandInterface
      * instance with the specified ID and command arguments.
      *
-     * @param string|CommandInterface $command Expected command or command ID.
-     * @param array $arguments Expected command arguments.
+     * @param string|CommandInterface $command   Expected command or command ID.
+     * @param array                   $arguments Expected command arguments.
      */
     public function isRedisCommand($command = null, array $arguments = null)
     {
@@ -38,7 +38,7 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
      * instance for $expected.
      *
      * @param array|string|CommandInterface $expected Expected command.
-     * @param mixed $actual Actual command.
+     * @param mixed                         $actual   Actual command.
      */
     public function assertRedisCommand($expected, $actual)
     {
@@ -56,7 +56,7 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
      * Asserts that two arrays have the same values, even if with different order.
      *
      * @param array $expected Expected array.
-     * @param array $actual Actual array.
+     * @param array $actual   Actual array.
      */
     public function assertSameValues(array $expected, array $actual)
     {
@@ -94,7 +94,7 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
      * Returns a named array with the default connection parameters merged with
      * the specified additional parameters.
      *
-     * @param array $additional Additional connection parameters.
+     * @param  array $additional Additional connection parameters.
      * @return array Connection parameters.
      */
     protected function getParametersArray(array $additional)
@@ -105,7 +105,7 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
     /**
      * Returns a new instance of connection parameters.
      *
-     * @param array $additional Additional connection parameters.
+     * @param  array                 $additional Additional connection parameters.
      * @return Connection\Parameters Default connection parameters.
      */
     protected function getParameters($additional = array())
@@ -119,7 +119,7 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
     /**
      * Returns a new instance of server profile.
      *
-     * @param array $additional Additional connection parameters.
+     * @param  array                    $additional Additional connection parameters.
      * @return Profile\ProfileInterface
      */
     protected function getProfile($version = null)
@@ -130,7 +130,7 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
     /**
      * Returns a new client instance.
      *
-     * @param bool $connect Flush selected database before returning the client.
+     * @param  bool   $connect Flush selected database before returning the client.
      * @return Client
      */
     protected function createClient(array $parameters = null, array $options = null, $flushdb = true)
@@ -158,8 +158,8 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
     }
 
     /**
-     * @param  string $expectedVersion Expected redis version
-     * @param  string $operator Comparison operator.
+     * @param  string                              $expectedVersion Expected redis version
+     * @param  string                              $operator        Comparison operator.
      * @throws \PHPUnit_Framework_SkippedTestError when expected redis version is not met
      */
     protected function executeOnRedisVersion($expectedVersion, $operator, $callback)
@@ -170,7 +170,7 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
         if (isset($info['server']['redis_version'])) {
             // Redis >= 2.6
             $version = $info['server']['redis_version'];
-        } else if (isset($info['redis_version'])) {
+        } elseif (isset($info['redis_version'])) {
             // Redis < 2.6
             $version = $info['redis_version'];
         } else {
@@ -187,8 +187,8 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
     }
 
     /**
-     * @param  string $expectedVersion Expected redis version
-     * @param  string $operator Comparison operator.
+     * @param  string                              $expectedVersion Expected redis version
+     * @param  string                              $operator        Comparison operator.
      * @throws \PHPUnit_Framework_SkippedTestError when expected redis version is not met
      */
     protected function executeOnProfileVersion($expectedVersion, $operator, $callback)
@@ -204,10 +204,10 @@ abstract class PredisTestCase extends PHPUnit_Framework_TestCase
     }
 
     /**
-     * @param  string $expectedVersion Expected redis version.
-     * @param  string $message Optional message.
-     * @param  bool $remote Based on local profile or remote redis version.
-     * @throws RuntimeException when unable to retrieve server info or redis version
+     * @param  string                              $expectedVersion Expected redis version.
+     * @param  string                              $message         Optional message.
+     * @param  bool                                $remote          Based on local profile or remote redis version.
+     * @throws RuntimeException                    when unable to retrieve server info or redis version
      * @throws \PHPUnit_Framework_SkippedTestError when expected redis version is not met
      */
     public function markTestSkippedOnRedisVersionBelow($expectedVersion, $message = '', $remote = true)

+ 1 - 1
tests/PHPUnit/RedisCommandConstraint.php

@@ -94,4 +94,4 @@ class RedisCommandConstraint extends PHPUnit_Framework_Constraint
 
         return "$string {$this->toString()}";
     }
-}
+}

+ 1 - 1
tests/Predis/ClientTest.php

@@ -826,7 +826,7 @@ class ClientTest extends PredisTestCase
     /**
      * Returns an URI string representation of the specified connection parameters.
      *
-     * @param array $parameters Array of connection parameters.
+     * @param  array  $parameters Array of connection parameters.
      * @return String URI string.
      */
     protected function getParametersString(array $parameters)

+ 1 - 1
tests/Predis/Cluster/PredisStrategyTest.php

@@ -243,7 +243,7 @@ class PredisStrategyTest extends PredisTestCase
     /**
      * Returns the list of expected supported commands.
      *
-     * @param string $type Optional type of command (based on its keys)
+     * @param  string $type Optional type of command (based on its keys)
      * @return array
      */
     protected function getExpectedCommands($type = null)

+ 1 - 1
tests/Predis/Cluster/RedisStrategyTest.php

@@ -250,7 +250,7 @@ class RedisStrategyTest extends PredisTestCase
     /**
      * Returns the list of expected supported commands.
      *
-     * @param string $type Optional type of command (based on its keys)
+     * @param  string $type Optional type of command (based on its keys)
      * @return array
      */
     protected function getExpectedCommands($type = null)

+ 2 - 2
tests/Predis/Command/KeySortTest.php

@@ -36,8 +36,8 @@ class KeySortTest extends PredisCommandTestCase
     /**
      * Utility method to to an LPUSH of some unordered values on a key.
      *
-     * @param Predis\Client $redis Redis client instance.
-     * @param string $key Target key
+     * @param  Predis\Client $redis Redis client instance.
+     * @param  string        $key   Target key
      * @return array
      */
     protected function lpushUnorderedList(Predis\Client $redis, $key)

+ 1 - 1
tests/Predis/Command/Processor/KeyPrefixProcessorTest.php

@@ -330,7 +330,7 @@ class KeyPrefixProcessorTest extends PredisTestCase
     /**
      * Data provider for key prefixing test.
      *
-     * @return  array
+     * @return array
      */
     public function commandArgumentsDataProvider()
     {

+ 0 - 1
tests/Predis/Command/ScriptCommandTest.php

@@ -37,7 +37,6 @@ class ScriptCommandTest extends PredisTestCase
                 ->will($this->returnValue(2));
         $command->setArguments($arguments);
 
-
         $this->assertSame(array_merge(array(self::LUA_SCRIPT_SHA1, 2), $arguments), $command->getArguments());
     }
 

+ 4 - 4
tests/Predis/Command/ZSetScanTest.php

@@ -102,8 +102,8 @@ class ZSetScanTest extends PredisCommandTestCase
         $response = $redis->zscan('key', 0);
 
         $this->assertSame(0, $response[0]);
-        $this->assertSame($expectedMembers, array_map(function($e) { return $e[0]; }, $response[1]));
-        $this->assertSame($expectedScores, array_map(function($e) { return $e[1]; }, $response[1]));
+        $this->assertSame($expectedMembers, array_map(function ($e) { return $e[0]; }, $response[1]));
+        $this->assertSame($expectedScores, array_map(function ($e) { return $e[1]; }, $response[1]));
     }
 
     /**
@@ -116,8 +116,8 @@ class ZSetScanTest extends PredisCommandTestCase
 
         $response = $redis->zscan('key', 0, 'MATCH', 'member:t*');
 
-        $this->assertSame(array('member:two', 'member:three'), array_map(function($e) { return $e[0]; }, $response[1]));
-        $this->assertSame(array(2.0, 3.0), array_map(function($e) { return $e[1]; }, $response[1]));
+        $this->assertSame(array('member:two', 'member:three'), array_map(function ($e) { return $e[0]; }, $response[1]));
+        $this->assertSame(array(2.0, 3.0), array_map(function ($e) { return $e[1]; }, $response[1]));
     }
 
     /**

+ 6 - 6
tests/Predis/CommunicationExceptionTest.php

@@ -78,7 +78,7 @@ class CommunicationExceptionTest extends PredisTestCase
     /**
      * Returns a mocked connection instance.
      *
-     * @param mixed $parameters Connection parameters.
+     * @param  mixed                                $parameters Connection parameters.
      * @return Connection\SingleConnectionInterface
      */
     protected function getMockedConnectionBase($parameters = null)
@@ -87,7 +87,7 @@ class CommunicationExceptionTest extends PredisTestCase
 
         if ($parameters === null) {
             $builder->disableOriginalConstructor();
-        } else if (!$parameters instanceof Connection\ParametersInterface) {
+        } elseif (!$parameters instanceof Connection\ParametersInterface) {
             $parameters = new Connection\Parameters($parameters);
         }
 
@@ -97,10 +97,10 @@ class CommunicationExceptionTest extends PredisTestCase
     /**
      * Returns a connection exception instance.
      *
-     * @param Connection\SingleConnectionInterface $message Connection instance.
-     * @param string $message Exception message.
-     * @param int $code Exception code.
-     * @param \Exception $inner Inner exception.
+     * @param  Connection\SingleConnectionInterface $message Connection instance.
+     * @param  string                               $message Exception message.
+     * @param  int                                  $code    Exception code.
+     * @param  \Exception                           $inner   Inner exception.
      * @return \Exception
      */
     protected function getException(

+ 0 - 1
tests/Predis/Configuration/ClusterOptionTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Configuration;
 
-use stdClass;
 use PredisTestCase;
 
 /**

+ 0 - 1
tests/Predis/Connection/FactoryTest.php

@@ -47,7 +47,6 @@ class FactoryTest extends PredisTestCase
         $this->assertEquals($tcp->host, $parameters->host);
         $this->assertEquals($tcp->database, $parameters->database);
 
-
         $unix = new Parameters(array(
             'scheme' => 'unix',
             'path' => '/tmp/redis.sock',

+ 2 - 1
tests/Predis/Connection/MasterSlaveReplicationTest.php

@@ -495,6 +495,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
 
         $replication->getReplicationStrategy()->setCommandReadOnly('exists', function ($cmd) {
             list($arg1) = $cmd->getArguments();
+
             return $arg1 === 'foo';
         });
 
@@ -568,7 +569,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
     /**
      * Returns a base mocked connection from Predis\Connection\SingleConnectionInterface.
      *
-     * @param mixed $parameters Optional parameters.
+     * @param  mixed $parameters Optional parameters.
      * @return mixed
      */
     protected function getMockConnection($parameters = null)

+ 1 - 1
tests/Predis/Connection/ParametersTest.php

@@ -254,7 +254,7 @@ class ParametersTest extends PredisTestCase
     /**
      * Returns an URI string representation of the specified connection parameters.
      *
-     * @param array $parameters array of connection parameters.
+     * @param  array  $parameters array of connection parameters.
      * @return String URI string.
      */
     protected function getParametersString(array $parameters)

+ 1 - 1
tests/Predis/Connection/PredisClusterTest.php

@@ -380,7 +380,7 @@ class PredisClusterTest extends PredisTestCase
     /**
      * Returns a base mocked connection from Predis\Connection\SingleConnectionInterface.
      *
-     * @param mixed $parameters Optional parameters.
+     * @param  mixed $parameters Optional parameters.
      * @return mixed
      */
     protected function getMockConnection($parameters = null)

+ 1 - 2
tests/Predis/Connection/RedisClusterTest.php

@@ -548,7 +548,6 @@ class RedisClusterTest extends PredisTestCase
                     ->with($command)
                     ->will($this->onConsecutiveCalls('foobar', 'foobar'));
 
-
         $factory = $this->getMock('Predis\Connection\Factory');
         $factory->expects($this->never())->method('create');
 
@@ -644,7 +643,7 @@ class RedisClusterTest extends PredisTestCase
     /**
      * Returns a base mocked connection from Predis\Connection\SingleConnectionInterface.
      *
-     * @param mixed $parameters Optional parameters.
+     * @param  mixed $parameters Optional parameters.
      * @return mixed
      */
     protected function getMockConnection($parameters = null)

+ 1 - 1
tests/Predis/Connection/WebdisConnectionTest.php

@@ -171,7 +171,7 @@ class WebdisConnectionTest extends PredisTestCase
     /**
      * Returns a new instance of a connection instance.
      *
-     * @param array $parameters Additional connection parameters.
+     * @param  array            $parameters Additional connection parameters.
      * @return WebdisConnection
      */
     protected function getConnection(&$profile = null, array $parameters = array())

+ 0 - 1
tests/Predis/Pipeline/AtomicTest.php

@@ -12,7 +12,6 @@
 namespace Predis\Pipeline;
 
 use PredisTestCase;
-use SplQueue;
 use Predis\Client;
 use Predis\Response;
 

+ 0 - 1
tests/Predis/Pipeline/FireAndForgetTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Pipeline;
 
-use SplQueue;
 use PredisTestCase;
 use Predis\Client;
 use Predis\Profile;

+ 2 - 2
tests/Predis/Pipeline/PipelineTest.php

@@ -468,8 +468,8 @@ class PipelineTest extends PredisTestCase
      * Returns a client instance connected to the specified Redis
      * server instance to perform integration tests.
      *
-     * @return array Additional connection parameters.
-     * @return array Additional client options.
+     * @return array  Additional connection parameters.
+     * @return array  Additional client options.
      * @return Client New client instance.
      */
     protected function getClient(array $parameters = array(), array $options = array())

+ 0 - 1
tests/Predis/Profile/FactoryTest.php

@@ -12,7 +12,6 @@
 namespace Predis\Profile;
 
 use PredisTestCase;
-use Predis\Command\Processor\ProcessorChain;
 
 /**
  *

+ 0 - 1
tests/Predis/Protocol/Text/ProtocolProcessorTest.php

@@ -36,7 +36,6 @@ class ProtocolProcessorTest extends PredisTestCase
                 ->method('getArguments')
                 ->will($this->returnValue(array()));
 
-
         $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface');
 
         $connection->expects($this->once())

+ 1 - 3
tests/Predis/Replication/ReplicationStrategyTest.php

@@ -118,7 +118,6 @@ class ReplicationStrategyTest extends PredisTestCase
                 ->method('getId')
                 ->will($this->returnValue('CMDTEST'));
 
-
         $strategy->setCommandReadOnly('CMDTEST', true);
         $this->assertTrue($strategy->isReadOperation($command));
     }
@@ -135,7 +134,6 @@ class ReplicationStrategyTest extends PredisTestCase
                 ->method('getId')
                 ->will($this->returnValue('CMDTEST'));
 
-
         $strategy->setCommandReadOnly('CMDTEST', false);
         $this->assertFalse($strategy->isReadOperation($command));
 
@@ -235,7 +233,7 @@ class ReplicationStrategyTest extends PredisTestCase
     /**
      * Returns the list of expected supported commands.
      *
-     * @param string $type Optional type of command (based on its keys)
+     * @param  string $type Optional type of command (based on its keys)
      * @return array
      */
     protected function getExpectedCommands($type = null)

+ 9 - 7
tests/Predis/Transaction/MultiExecTest.php

@@ -730,7 +730,7 @@ class MultiExecTest extends PredisTestCase
      * Returns a mocked instance of Predis\Connection\SingleConnectionInterface
      * using the specified callback to return values from executeCommand().
      *
-     * @param \Closure $executeCallback
+     * @param  \Closure                                     $executeCallback
      * @return \Predis\Connection\SingleConnectionInterface
      */
     protected function getMockedConnection($executeCallback)
@@ -748,7 +748,7 @@ class MultiExecTest extends PredisTestCase
      * the specified callback to return values from the executeCommand method
      * of the underlying connection.
      *
-     * @param \Closure $executeCallback
+     * @param  \Closure  $executeCallback
      * @return MultiExec
      */
     protected function getMockedTransaction($executeCallback, $txOpts = null, $clientOpts = null)
@@ -763,8 +763,8 @@ class MultiExecTest extends PredisTestCase
     /**
      * Returns a callback that emulates a server-side MULTI/EXEC transaction context.
      *
-     * @param array $expected Expected responses.
-     * @param array $commands Reference to an array that stores the whole flow of commands.
+     * @param  array    $expected Expected responses.
+     * @param  array    $commands Reference to an array that stores the whole flow of commands.
      * @return \Closure
      */
     protected function getExecuteCallback($expected = array(), &$commands = array(), &$cas = array())
@@ -805,6 +805,7 @@ class MultiExecTest extends PredisTestCase
                     if ($abort) {
                         $commands = $cas = array();
                         $abort = false;
+
                         return null;
                     }
 
@@ -844,11 +845,12 @@ class MultiExecTest extends PredisTestCase
      * Converts an array of instances of Predis\Command\CommandInterface and
      * returns an array containing their IDs.
      *
-     * @param array $commands List of commands instances.
+     * @param  array $commands List of commands instances.
      * @return array
      */
-    protected static function commandsToIDs($commands) {
-        return array_map(function($cmd) { return $cmd->getId(); }, $commands);
+    protected static function commandsToIDs($commands)
+    {
+        return array_map(function ($cmd) { return $cmd->getId(); }, $commands);
     }
 
     /**