diff --git a/tests/PHPUnit/PredisConnectionTestCase.php b/tests/PHPUnit/PredisConnectionTestCase.php index 9bdd7067..e0ae0a86 100644 --- a/tests/PHPUnit/PredisConnectionTestCase.php +++ b/tests/PHPUnit/PredisConnectionTestCase.php @@ -360,7 +360,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase $cmdPing ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue(array())); + ->willReturn(array()); /** @var CommandInterface|MockObject */ $cmdEcho = $this->getMockBuilder($commands->getCommandClass('echo')) @@ -370,7 +370,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase $cmdEcho ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue(array('ECHOED'))); + ->willReturn(array('ECHOED')); $connection = $this->createConnection(); $connection->addConnectCommand($cmdPing); diff --git a/tests/Predis/ClientTest.php b/tests/Predis/ClientTest.php index c1529104..c11cc1d2 100644 --- a/tests/Predis/ClientTest.php +++ b/tests/Predis/ClientTest.php @@ -248,7 +248,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($connection)); + ->willReturn($connection); $client = new Client($callable); @@ -272,7 +272,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($wrongType)); + ->willReturn($wrongType); new Client($callable); } @@ -330,7 +330,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface'), $arg1) - ->will($this->returnValue($connection)); + ->willReturn($connection); $fnreplication = $this->getMockBuilder('stdClass') ->addMethods(array('__invoke')) @@ -373,7 +373,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface'), $arg1) - ->will($this->returnValue($connection)); + ->willReturn($connection); $fnaggregate = $this->getMockBuilder('stdClass') ->addMethods(array('__invoke')) @@ -406,7 +406,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface'), $arg1) - ->will($this->returnValue($connection)); + ->willReturn($connection); $connections = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); $connections @@ -500,7 +500,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('create') ->with('ping', array()) - ->will($this->returnValue($ping)); + ->willReturn($ping); $client = new Client(null, array('commands' => $commands)); $this->assertSame($ping, $client->createCommand('ping', array())); @@ -521,12 +521,12 @@ class ClientTest extends PredisTestCase ->expects($this->at(0)) ->method('executeCommand') ->with($ping) - ->will($this->returnValue(new Response\Status('PONG'))); + ->willReturn(new Response\Status('PONG')); $connection ->expects($this->at(1)) ->method('executeCommand') ->with($hgetall) - ->will($this->returnValue(array('foo', 'bar', 'hoge', 'piyo'))); + ->willReturn(array('foo', 'bar', 'hoge', 'piyo')); $client = new Client($connection); @@ -549,7 +549,7 @@ class ClientTest extends PredisTestCase $connection ->expects($this->once()) ->method('executeCommand') - ->will($this->returnValue($expectedResponse)); + ->willReturn($expectedResponse); $client = new Client($connection); $client->executeCommand($ping); @@ -567,7 +567,7 @@ class ClientTest extends PredisTestCase $connection ->expects($this->once()) ->method('executeCommand') - ->will($this->returnValue($expectedResponse)); + ->willReturn($expectedResponse); $client = new Client($connection, array('exceptions' => false)); $response = $client->executeCommand($ping); @@ -587,14 +587,14 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($this->isInstanceOf('Predis\Command\Redis\PING')) - ->will($this->returnValue('PONG')); + ->willReturn('PONG'); $commands = $this->getMockBuilder('Predis\Command\FactoryInterface')->getMock(); $commands ->expects($this->once()) ->method('create') ->with('ping', array()) - ->will($this->returnValue($ping)); + ->willReturn($ping); $options = array('commands' => $commands); @@ -622,7 +622,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($this->isRedisCommand('PING')) - ->will($this->returnValue($expectedResponse)); + ->willReturn($expectedResponse); $client = new Client($connection); $client->ping(); @@ -640,7 +640,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($this->isRedisCommand('PING')) - ->will($this->returnValue($expectedResponse)); + ->willReturn($expectedResponse); $client = new Client($connection, array('exceptions' => false)); $response = $client->ping(); @@ -658,17 +658,17 @@ class ClientTest extends PredisTestCase ->expects($this->at(0)) ->method('executeCommand') ->with($this->isRedisCommand('SET', array('foo', 'bar'))) - ->will($this->returnValue(new Response\Status('OK'))); + ->willReturn(new Response\Status('OK')); $connection ->expects($this->at(1)) ->method('executeCommand') ->with($this->isRedisCommand('GET', array('foo'))) - ->will($this->returnValue('bar')); + ->willReturn('bar'); $connection ->expects($this->at(2)) ->method('executeCommand') ->with($this->isRedisCommand('PING')) - ->will($this->returnValue('PONG')); + ->willReturn('PONG'); $client = new Client($connection); @@ -690,12 +690,12 @@ class ClientTest extends PredisTestCase ->expects($this->at(0)) ->method('executeCommand') ->with($this->isRedisCommand('SET', array('foo', 'bar'))) - ->will($this->returnValue(new Response\Status('OK'))); + ->willReturn(new Response\Status('OK')); $connection ->expects($this->at(1)) ->method('executeCommand') ->with($this->isRedisCommand('GET', array('foo'))) - ->will($this->returnValue('bar')); + ->willReturn('bar'); $client = new Client($connection, array('prefix' => 'predis:')); @@ -716,7 +716,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($this->isRedisCommand('PING')) - ->will($this->returnValue($response)); + ->willReturn($response); $client = new Client($connection, array('exceptions' => true)); @@ -768,7 +768,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('getConnectionById') ->with('127.0.0.1:6379') - ->will($this->returnValue($connection)); + ->willReturn($connection); $client = new Client($aggregate); $nodeClient = $client->getClientBy('id', '127.0.0.1:6379'); @@ -790,7 +790,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('getConnectionById') ->with('127.0.0.1:7000') - ->will($this->returnValue(null)); + ->willReturn(null); $client = new Client($aggregate); $client->getClientBy('id', '127.0.0.1:7000'); @@ -810,7 +810,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('getConnectionByAlias') ->with('myalias') - ->will($this->returnValue($connection)); + ->willReturn($connection); $client = new Client($aggregate); $nodeClient = $client->getClientBy('alias', 'myalias'); @@ -833,7 +833,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('getConnectionByKey') ->with('key:1') - ->will($this->returnValue($connection)); + ->willReturn($connection); $client = new Client($aggregate); $nodeClient = $client->getClientBy('key', 'key:1'); @@ -856,7 +856,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('getConnectionBySlot') ->with(5460) - ->will($this->returnValue($connection)); + ->willReturn($connection); $client = new Client($aggregate); $nodeClient = $client->getClientBy('slot', 5460); @@ -879,7 +879,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('getConnectionByRole') ->with('master') - ->will($this->returnValue($connection)); + ->willReturn($connection); $client = new Client($aggregate); $nodeClient = $client->getClientBy('role', 'master'); @@ -903,7 +903,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('getConnectionByCommand') ->with($command) - ->will($this->returnValue($connection)); + ->willReturn($connection); $client = new Client($aggregate); $nodeClient = $client->getClientBy('command', $command); @@ -1017,7 +1017,7 @@ class ClientTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue(array('subscribe', 'channel', 0))); + ->willReturn(array('subscribe', 'channel', 0)); $callable = $this->getMockBuilder('stdClass') ->addMethods(array('__invoke')) @@ -1039,7 +1039,7 @@ class ClientTest extends PredisTestCase $connection ->expects($this->at(1)) ->method('read') - ->will($this->returnValue(array('subscribe', 'channel', 1))); + ->willReturn(array('subscribe', 'channel', 1)); $connection ->expects($this->at(2)) ->method('writeRequest') @@ -1047,7 +1047,7 @@ class ClientTest extends PredisTestCase $connection ->expects($this->at(3)) ->method('read') - ->will($this->returnValue(array('unsubscribe', 'channel', 0))); + ->willReturn(array('unsubscribe', 'channel', 0)); $callable = $this->getMockBuilder('stdClass') ->addMethods(array('__invoke')) @@ -1055,7 +1055,7 @@ class ClientTest extends PredisTestCase $callable ->expects($this->at(0)) ->method('__invoke') - ->will($this->returnValue(false)); + ->willReturn(false); $client = new Client($connection); @@ -1105,7 +1105,7 @@ class ClientTest extends PredisTestCase $connection ->expects($this->once()) ->method('executeCommand') - ->will($this->returnValue(new Response\Status('QUEUED'))); + ->willReturn(new Response\Status('QUEUED')); $callable = $this->getMockBuilder('stdClass') ->addMethods(array('__invoke')) @@ -1113,7 +1113,7 @@ class ClientTest extends PredisTestCase $callable ->expects($this->once()) ->method('__invoke') - ->will($this->returnCallback(function ($tx) { $tx->ping(); })); + ->willReturnCallback(function ($tx) { $tx->ping(); }); $client = new Client($connection); $client->transaction($options, $callable); @@ -1139,24 +1139,24 @@ class ClientTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue('return redis.call(\'exists\', KEYS[1])')); + ->willReturn('return redis.call(\'exists\', KEYS[1])'); $command ->expects($this->once()) ->method('parseResponse') ->with('OK') - ->will($this->returnValue(true)); + ->willReturn(true); $connection = $this->getMockBuilder('Predis\Connection\NodeConnectionInterface')->getMock(); $connection ->expects($this->at(0)) ->method('executeCommand') ->with($command) - ->will($this->returnValue(new Response\Error('NOSCRIPT'))); + ->willReturn(new Response\Error('NOSCRIPT')); $connection ->expects($this->at(1)) ->method('executeCommand') ->with($this->isRedisCommand('EVAL')) - ->will($this->returnValue('OK')); + ->willReturn('OK'); $client = new Client($connection); @@ -1263,7 +1263,7 @@ class ClientTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface'), $parameters) - ->will($this->returnValue($connection)); + ->willReturn($connection); return $callable; } diff --git a/tests/Predis/Cluster/Distributor/HashRingTest.php b/tests/Predis/Cluster/Distributor/HashRingTest.php index 2a8f64e0..6be751ef 100644 --- a/tests/Predis/Cluster/Distributor/HashRingTest.php +++ b/tests/Predis/Cluster/Distributor/HashRingTest.php @@ -204,7 +204,7 @@ class HashRingTest extends PredisDistributorTestCase ->expects($this->once()) ->method('__invoke') ->with($node) - ->will($this->returnValue($node)); + ->willReturn($node); $distributor = new HashRing(HashRing::DEFAULT_REPLICAS, $callable); $distributor->add($node); diff --git a/tests/Predis/Cluster/Distributor/KetamaRingTest.php b/tests/Predis/Cluster/Distributor/KetamaRingTest.php index e9711c29..e320d815 100644 --- a/tests/Predis/Cluster/Distributor/KetamaRingTest.php +++ b/tests/Predis/Cluster/Distributor/KetamaRingTest.php @@ -205,7 +205,7 @@ class KetamaRingTest extends PredisDistributorTestCase ->expects($this->once()) ->method('__invoke') ->with($node) - ->will($this->returnValue($node)); + ->willReturn($node); $distributor = new KetamaRing($callable); $distributor->add($node); diff --git a/tests/Predis/Cluster/PredisStrategyTest.php b/tests/Predis/Cluster/PredisStrategyTest.php index 776111a8..a6268b7e 100644 --- a/tests/Predis/Cluster/PredisStrategyTest.php +++ b/tests/Predis/Cluster/PredisStrategyTest.php @@ -233,11 +233,11 @@ class PredisStrategyTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue('return true')); + ->willReturn('return true'); $command ->expects($this->exactly(2)) ->method('getKeysCount') - ->will($this->returnValue(2)); + ->willReturn(2); $command->setArguments($arguments); $this->assertNotNull($strategy->getSlot($command), "Script Command [{$command->getId()}]"); @@ -274,7 +274,7 @@ class PredisStrategyTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Command\CommandInterface')) - ->will($this->returnValue('key')); + ->willReturn('key'); /** @var PredisStrategy */ $strategy = $this->getClusterStrategy(); diff --git a/tests/Predis/Cluster/RedisStrategyTest.php b/tests/Predis/Cluster/RedisStrategyTest.php index 57820c34..2fb8c494 100644 --- a/tests/Predis/Cluster/RedisStrategyTest.php +++ b/tests/Predis/Cluster/RedisStrategyTest.php @@ -248,11 +248,11 @@ class RedisStrategyTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue('return true')); + ->willReturn('return true'); $command ->expects($this->exactly(2)) ->method('getKeysCount') - ->will($this->returnValue(1)); + ->willReturn(1); $command->setArguments($arguments); $this->assertNotNull($strategy->getSlot($command), "Script Command [{$command->getId()}]"); @@ -288,7 +288,7 @@ class RedisStrategyTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Command\CommandInterface')) - ->will($this->returnValue('key')); + ->willReturn('key'); /** @var RedisStrategy */ $strategy = $this->getClusterStrategy(); diff --git a/tests/Predis/Cluster/SlotMapTest.php b/tests/Predis/Cluster/SlotMapTest.php index 7508ce4c..842f0d9a 100644 --- a/tests/Predis/Cluster/SlotMapTest.php +++ b/tests/Predis/Cluster/SlotMapTest.php @@ -130,7 +130,7 @@ class SlotMapTest extends PredisTestCase $connection ->expects($this->once()) ->method('__toString') - ->will($this->returnValue('127.0.0.1:6379')); + ->willReturn('127.0.0.1:6379'); $slotmap->setSlots(10, 10, $connection); @@ -433,7 +433,7 @@ class SlotMapTest extends PredisTestCase $connection ->expects($this->once()) ->method('__toString') - ->will($this->returnValue('127.0.0.1:6379')); + ->willReturn('127.0.0.1:6379'); $this->assertSame($connection, $slotmap[0] = $connection); $this->assertSame('127.0.0.1:6379', $slotmap[0]); diff --git a/tests/Predis/Collection/Iterator/HashKeyTest.php b/tests/Predis/Collection/Iterator/HashKeyTest.php index 1267787f..8173c728 100644 --- a/tests/Predis/Collection/Iterator/HashKeyTest.php +++ b/tests/Predis/Collection/Iterator/HashKeyTest.php @@ -30,14 +30,14 @@ class HashKeyTest extends PredisTestCase $commands ->expects($this->any()) ->method('supports') - ->will($this->returnValue(false)); + ->willReturn(false); /** @var \Predis\ClientInterface */ $client = $this->getMockBuilder('Predis\ClientInterface')->getMock(); $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($commands)); + ->willReturn($commands); new HashKey($client, 'key:hash'); } @@ -55,14 +55,14 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('hscan') ->with('key:hash', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array(), - ))); + )); $iterator = new HashKey($client, 'key:hash'); @@ -85,14 +85,14 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('hscan') ->with('key:hash', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array(1 => 'a', 2 => 'b', 3 => 100, 'foo' => 'bar')) - )); + ); $iterator = new HashKey($client, 'key:hash'); @@ -133,14 +133,14 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('hscan') ->with('key:hash', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('field:1st' => 'value:1st', 'field:2nd' => 'value:2nd', 'field:3rd' => 'value:3rd')) - )); + ); $iterator = new HashKey($client, 'key:hash'); @@ -176,7 +176,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -226,7 +226,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -271,7 +271,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -328,7 +328,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -366,7 +366,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -411,7 +411,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -449,7 +449,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -494,7 +494,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -532,7 +532,7 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('hscan') @@ -577,14 +577,14 @@ class HashKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->exactly(2)) ->method('hscan') ->with('key:hash', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('field:1st' => 'value:1st', 'field:2nd' => 'value:2nd')) - )); + ); $iterator = new HashKey($client, 'key:hash'); diff --git a/tests/Predis/Collection/Iterator/KeyspaceTest.php b/tests/Predis/Collection/Iterator/KeyspaceTest.php index f39d8d8a..835a6412 100644 --- a/tests/Predis/Collection/Iterator/KeyspaceTest.php +++ b/tests/Predis/Collection/Iterator/KeyspaceTest.php @@ -30,14 +30,14 @@ class KeyspaceTest extends PredisTestCase $commands ->expects($this->any()) ->method('supports') - ->will($this->returnValue(false)); + ->willReturn(false); /** @var \Predis\ClientInterface */ $client = $this->getMockBuilder('Predis\ClientInterface')->getMock(); $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($commands)); + ->willReturn($commands); new Keyspace($client); } @@ -55,14 +55,14 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('scan') ->with(0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array()) - )); + ); $iterator = new Keyspace($client); @@ -83,14 +83,14 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('scan') ->with(0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('key:1st', 'key:2nd', 'key:3rd')) - )); + ); $iterator = new Keyspace($client); @@ -126,21 +126,21 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array()) - ->will($this->returnValue( + ->willReturn( array(2, array('key:1st', 'key:2nd')) - )); + ); $client ->expects($this->at(2)) ->method('scan') ->with(2, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('key:3rd')) - )); + ); $iterator = new Keyspace($client); @@ -176,21 +176,21 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array()) - ->will($this->returnValue( + ->willReturn( array(4, array()) - )); + ); $client ->expects($this->at(2)) ->method('scan') ->with(4, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('key:1st', 'key:2nd')) - )); + ); $iterator = new Keyspace($client); @@ -221,28 +221,28 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array()) - ->will($this->returnValue( + ->willReturn( array(2, array('key:1st', 'key:2nd')) - )); + ); $client ->expects($this->at(2)) ->method('scan') ->with(2, array()) - ->will($this->returnValue( + ->willReturn( array(5, array()) - )); + ); $client ->expects($this->at(3)) ->method('scan') ->with(5, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('key:3rd')) - )); + ); $iterator = new Keyspace($client); @@ -278,14 +278,14 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array('MATCH' => 'key:*')) - ->will($this->returnValue( + ->willReturn( array(0, array('key:1st', 'key:2nd')) - )); + ); $iterator = new Keyspace($client, 'key:*'); @@ -316,21 +316,21 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array('MATCH' => 'key:*')) - ->will($this->returnValue( + ->willReturn( array(1, array('key:1st')) - )); + ); $client ->expects($this->at(2)) ->method('scan') ->with(1, array('MATCH' => 'key:*')) - ->will($this->returnValue( + ->willReturn( array(0, array('key:2nd')) - )); + ); $iterator = new Keyspace($client, 'key:*'); @@ -361,14 +361,14 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array('COUNT' => 2)) - ->will($this->returnValue( + ->willReturn( array(0, array('key:1st', 'key:2nd')) - )); + ); $iterator = new Keyspace($client, null, 2); @@ -399,19 +399,19 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array('COUNT' => 1)) - ->will($this->returnValue(array(1, array('key:1st')))); + ->willReturn(array(1, array('key:1st'))); $client ->expects($this->at(2)) ->method('scan') ->with(1, array('COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(0, array('key:2nd')) - )); + ); $iterator = new Keyspace($client, null, 1); @@ -442,14 +442,14 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array('MATCH' => 'key:*', 'COUNT' => 2)) - ->will($this->returnValue( + ->willReturn( array(0, array('key:1st', 'key:2nd')) - )); + ); $iterator = new Keyspace($client, 'key:*', 2); @@ -480,21 +480,21 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('scan') ->with(0, array('MATCH' => 'key:*', 'COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(1, array('key:1st')) - )); + ); $client ->expects($this->at(2)) ->method('scan') ->with(1, array('MATCH' => 'key:*', 'COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(0, array('key:2nd')) - )); + ); $iterator = new Keyspace($client, 'key:*', 1); @@ -525,14 +525,14 @@ class KeyspaceTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->exactly(2)) ->method('scan') ->with(0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('key:1st', 'key:2nd')) - )); + ); $iterator = new Keyspace($client); diff --git a/tests/Predis/Collection/Iterator/ListKeyTest.php b/tests/Predis/Collection/Iterator/ListKeyTest.php index b071ba55..10615997 100644 --- a/tests/Predis/Collection/Iterator/ListKeyTest.php +++ b/tests/Predis/Collection/Iterator/ListKeyTest.php @@ -30,7 +30,7 @@ class ListKeyTest extends PredisTestCase $commands ->expects($this->any()) ->method('supports') - ->will($this->returnValue(false)); + ->willReturn(false); /** @var \Predis\ClientInterface */ $client = $this->getMockBuilder('Predis\Client') @@ -40,7 +40,7 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($commands)); + ->willReturn($commands); new ListKey($client, 'key:list'); } @@ -58,14 +58,14 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('lrange') ->with('key:list', 0, 9) - ->will($this->returnValue( + ->willReturn( array() - )); + ); $iterator = new ListKey($client, 'key:list'); @@ -86,14 +86,14 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('lrange') ->with('key:list', 0, 9) - ->will($this->returnValue( + ->willReturn( array('item:1', 'item:2', 'item:3') - )); + ); $iterator = new ListKey($client, 'key:list'); @@ -129,7 +129,7 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('lrange') @@ -144,7 +144,7 @@ class ListKeyTest extends PredisTestCase ->expects($this->at(2)) ->method('lrange') ->with('key:list', 10, 19) - ->will($this->returnValue(array('item:11', 'item:12'))); + ->willReturn(array('item:11', 'item:12')); $iterator = new ListKey($client, 'key:list'); @@ -172,7 +172,7 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); new ListKey($client, 'key:list', 'wrong'); } @@ -192,7 +192,7 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); new ListKey($client, 'key:list', 'wrong'); } @@ -210,7 +210,7 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('lrange') @@ -248,7 +248,7 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('lrange') @@ -298,14 +298,14 @@ class ListKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->exactly(2)) ->method('lrange') ->with('key:list', 0, 9) - ->will($this->returnValue( + ->willReturn( array('item:1', 'item:2') - )); + ); $iterator = new ListKey($client, 'key:list'); diff --git a/tests/Predis/Collection/Iterator/SetKeyTest.php b/tests/Predis/Collection/Iterator/SetKeyTest.php index 7b13ba9b..a4e51065 100644 --- a/tests/Predis/Collection/Iterator/SetKeyTest.php +++ b/tests/Predis/Collection/Iterator/SetKeyTest.php @@ -30,14 +30,14 @@ class SetKeyTest extends PredisTestCase $commands ->expects($this->any()) ->method('supports') - ->will($this->returnValue(false)); + ->willReturn(false); /** @var \Predis\ClientInterface */ $client = $this->getMockBuilder('Predis\ClientInterface')->getMock(); $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($commands)); + ->willReturn($commands); new SetKey($client, 'key:set'); } @@ -55,14 +55,14 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('sscan') ->with('key:set', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array()) - )); + ); $iterator = new SetKey($client, 'key:set'); @@ -83,14 +83,14 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('sscan') ->with('key:set', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st', 'member:2nd', 'member:3rd')) - )); + ); $iterator = new SetKey($client, 'key:set'); @@ -126,21 +126,21 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array()) - ->will($this->returnValue( + ->willReturn( array(2, array('member:1st', 'member:2nd')) - )); + ); $client ->expects($this->at(2)) ->method('sscan') ->with('key:set', 2, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:3rd')) - )); + ); $iterator = new SetKey($client, 'key:set'); @@ -176,21 +176,21 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array()) - ->will($this->returnValue( + ->willReturn( array(4, array()) - )); + ); $client ->expects($this->at(2)) ->method('sscan') ->with('key:set', 4, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st', 'member:2nd')) - )); + ); $iterator = new SetKey($client, 'key:set'); @@ -221,28 +221,28 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array()) - ->will($this->returnValue( + ->willReturn( array(2, array('member:1st', 'member:2nd')) - )); + ); $client ->expects($this->at(2)) ->method('sscan') ->with('key:set', 2, array()) - ->will($this->returnValue( + ->willReturn( array(5, array()) - )); + ); $client ->expects($this->at(3)) ->method('sscan') ->with('key:set', 5, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:3rd')) - )); + ); $iterator = new SetKey($client, 'key:set'); @@ -278,14 +278,14 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array('MATCH' => 'member:*')) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st', 'member:2nd')) - )); + ); $iterator = new SetKey($client, 'key:set', 'member:*'); @@ -316,21 +316,21 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array('MATCH' => 'member:*')) - ->will($this->returnValue( + ->willReturn( array(1, array('member:1st')) - )); + ); $client ->expects($this->at(2)) ->method('sscan') ->with('key:set', 1, array('MATCH' => 'member:*')) - ->will($this->returnValue( + ->willReturn( array(0, array('member:2nd')) - )); + ); $iterator = new SetKey($client, 'key:set', 'member:*'); @@ -361,14 +361,14 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array('COUNT' => 2)) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st', 'member:2nd')) - )); + ); $iterator = new SetKey($client, 'key:set', null, 2); @@ -399,21 +399,21 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array('COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(1, array('member:1st')) - )); + ); $client ->expects($this->at(2)) ->method('sscan') ->with('key:set', 1, array('COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(0, array('member:2nd')) - )); + ); $iterator = new SetKey($client, 'key:set', null, 1); @@ -444,14 +444,14 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array('MATCH' => 'member:*', 'COUNT' => 2)) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st', 'member:2nd')) - )); + ); $iterator = new SetKey($client, 'key:set', 'member:*', 2); @@ -482,21 +482,21 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('sscan') ->with('key:set', 0, array('MATCH' => 'member:*', 'COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(1, array('member:1st')) - )); + ); $client ->expects($this->at(2)) ->method('sscan') ->with('key:set', 1, array('MATCH' => 'member:*', 'COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(0, array('member:2nd')) - )); + ); $iterator = new SetKey($client, 'key:set', 'member:*', 1); @@ -527,14 +527,14 @@ class SetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->exactly(2)) ->method('sscan') ->with('key:set', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st', 'member:2nd')) - )); + ); $iterator = new SetKey($client, 'key:set'); diff --git a/tests/Predis/Collection/Iterator/SortedSetKeyTest.php b/tests/Predis/Collection/Iterator/SortedSetKeyTest.php index d1bbc0bd..7c841d50 100644 --- a/tests/Predis/Collection/Iterator/SortedSetKeyTest.php +++ b/tests/Predis/Collection/Iterator/SortedSetKeyTest.php @@ -31,14 +31,14 @@ class SortedSetKeyTest extends PredisTestCase $commands ->expects($this->any()) ->method('supports') - ->will($this->returnValue(false)); + ->willReturn(false); /** @var \Predis\ClientInterface */ $client = $this->getMockBuilder('Predis\ClientInterface')->getMock(); $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($commands)); + ->willReturn($commands); new SortedSetKey($client, 'key:zset'); } @@ -56,14 +56,14 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('zscan') ->with('key:zset', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array()) - )); + ); $iterator = new SortedSetKey($client, 'key:zset'); @@ -85,14 +85,14 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('zscan') ->with('key:zset', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array(0 => 0, 101 => 1, 102 => 2)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset'); @@ -128,14 +128,14 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->once()) ->method('zscan') ->with('key:zset', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st' => 1.0, 'member:2nd' => 2.0, 'member:3rd' => 3.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset'); @@ -171,21 +171,21 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array()) - ->will($this->returnValue( + ->willReturn( array(2, array('member:1st' => 1.0, 'member:2nd' => 2.0)) - )); + ); $client ->expects($this->at(2)) ->method('zscan') ->with('key:zset', 2, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:3rd' => 3.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset'); @@ -221,21 +221,21 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array()) - ->will($this->returnValue( + ->willReturn( array(4, array()) - )); + ); $client ->expects($this->at(2)) ->method('zscan') ->with('key:zset', 4, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st' => 1.0, 'member:2nd' => 2.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset'); @@ -266,28 +266,28 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array()) - ->will($this->returnValue( + ->willReturn( array(2, array('member:1st' => 1.0, 'member:2nd' => 2.0)) - )); + ); $client ->expects($this->at(2)) ->method('zscan') ->with('key:zset', 2, array()) - ->will($this->returnValue( + ->willReturn( array(5, array()) - )); + ); $client ->expects($this->at(3)) ->method('zscan') ->with('key:zset', 5, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:3rd' => 3.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset'); @@ -323,14 +323,14 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array('MATCH' => 'member:*')) - ->will($this->returnValue( + ->willReturn( array(2, array('member:1st' => 1.0, 'member:2nd' => 2.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset', 'member:*'); @@ -361,21 +361,21 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array('MATCH' => 'member:*')) - ->will($this->returnValue( + ->willReturn( array(1, array('member:1st' => 1.0)) - )); + ); $client ->expects($this->at(2)) ->method('zscan') ->with('key:zset', 1, array('MATCH' => 'member:*')) - ->will($this->returnValue( + ->willReturn( array(0, array('member:2nd' => 2.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset', 'member:*'); @@ -406,14 +406,14 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array('COUNT' => 2)) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st' => 1.0, 'member:2nd' => 2.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset', null, 2); @@ -444,21 +444,21 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array('COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(1, array('member:1st' => 1.0)) - )); + ); $client ->expects($this->at(2)) ->method('zscan') ->with('key:zset', 1, array('COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(0, array('member:2nd' => 2.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset', null, 1); @@ -489,14 +489,14 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array('MATCH' => 'member:*', 'COUNT' => 2)) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st' => 1.0, 'member:2nd' => 2.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset', 'member:*', 2); @@ -527,21 +527,21 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->at(1)) ->method('zscan') ->with('key:zset', 0, array('MATCH' => 'member:*', 'COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(1, array('member:1st' => 1.0)) - )); + ); $client ->expects($this->at(2)) ->method('zscan') ->with('key:zset', 1, array('MATCH' => 'member:*', 'COUNT' => 1)) - ->will($this->returnValue( + ->willReturn( array(0, array('member:2nd' => 2.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset', 'member:*', 1); @@ -572,14 +572,14 @@ class SortedSetKeyTest extends PredisTestCase $client ->expects($this->any()) ->method('getCommandFactory') - ->will($this->returnValue($this->getCommandFactory())); + ->willReturn($this->getCommandFactory()); $client ->expects($this->exactly(2)) ->method('zscan') ->with('key:zset', 0, array()) - ->will($this->returnValue( + ->willReturn( array(0, array('member:1st' => 1.0, 'member:2nd' => 2.0)) - )); + ); $iterator = new SortedSetKey($client, 'key:zset'); diff --git a/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php b/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php index e9861c3c..899e689e 100644 --- a/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php +++ b/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php @@ -79,7 +79,7 @@ class KeyPrefixProcessorTest extends PredisTestCase $command = $this->getMockBuilder('Predis\Command\CommandInterface')->getMock(); $command->expects($this->once()) ->method('getId') - ->will($this->returnValue('unknown')); + ->willReturn('unknown'); $command ->expects($this->never()) ->method('getArguments'); @@ -304,9 +304,9 @@ class KeyPrefixProcessorTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($command, 'prefix:') - ->will($this->returnCallback(function ($command, $prefix) { + ->willReturnCallback(function ($command, $prefix) { $command->setRawArguments(array('prefix:key', 'value')); - })); + }); $processor = new KeyPrefixProcessor('prefix:'); $processor->setCommandHandler('NEWCMD', $callable); @@ -329,9 +329,9 @@ class KeyPrefixProcessorTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($command, 'prefix:') - ->will($this->returnCallback(function ($command, $prefix) { + ->willReturnCallback(function ($command, $prefix) { $command->setRawArguments(array('prefix:key', 'value')); - })); + }); $processor = new KeyPrefixProcessor('prefix:'); $processor->setCommandHandler('SET', $callable); diff --git a/tests/Predis/Command/RedisFactoryTest.php b/tests/Predis/Command/RedisFactoryTest.php index e8557327..27a961fd 100644 --- a/tests/Predis/Command/RedisFactoryTest.php +++ b/tests/Predis/Command/RedisFactoryTest.php @@ -245,11 +245,11 @@ class RedisFactoryTest extends PredisTestCase ->expects($this->once()) ->method('process') ->with($this->isInstanceOf('Predis\Command\CommandInterface')) - ->will($this->returnCallback( + ->willReturnCallback( function (CommandInterface $cmd) use (&$argsRef) { $cmd->setRawArguments($argsRef = array_map('strtoupper', $cmd->getArguments())); } - )); + ); $factory = new RedisFactory(); $factory->setProcessor($processor); diff --git a/tests/Predis/Command/ScriptCommandTest.php b/tests/Predis/Command/ScriptCommandTest.php index 53db43d5..9aa254bf 100644 --- a/tests/Predis/Command/ScriptCommandTest.php +++ b/tests/Predis/Command/ScriptCommandTest.php @@ -47,11 +47,11 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->exactly(2)) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command ->expects($this->once()) ->method('getKeysCount') - ->will($this->returnValue(2)); + ->willReturn(2); $command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2')); @@ -70,11 +70,11 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command ->expects($this->exactly(2)) ->method('getKeysCount') - ->will($this->returnValue(2)); + ->willReturn(2); $command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2')); @@ -93,7 +93,7 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command->setArguments($arguments = array('value1', 'value2', 'value3')); @@ -112,11 +112,11 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command ->expects($this->exactly(2)) ->method('getKeysCount') - ->will($this->returnValue(-2)); + ->willReturn(-2); $command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2')); @@ -135,11 +135,11 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command ->expects($this->once()) ->method('getKeysCount') - ->will($this->returnValue(2)); + ->willReturn(2); $command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2')); @@ -158,7 +158,7 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2')); @@ -177,11 +177,11 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->once()) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command ->expects($this->once()) ->method('getKeysCount') - ->will($this->returnValue(-2)); + ->willReturn(-2); $command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2')); @@ -200,11 +200,11 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->exactly(2)) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command ->expects($this->once()) ->method('getKeysCount') - ->will($this->returnValue(2)); + ->willReturn(2); $command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2')); @@ -223,11 +223,11 @@ class ScriptCommandTest extends PredisTestCase $command ->expects($this->exactly(2)) ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); + ->willReturn(self::LUA_SCRIPT); $command ->expects($this->once()) ->method('getKeysCount') - ->will($this->returnValue(2)); + ->willReturn(2); $command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2')); diff --git a/tests/Predis/CommunicationExceptionTest.php b/tests/Predis/CommunicationExceptionTest.php index 506417d1..f0f81bbe 100644 --- a/tests/Predis/CommunicationExceptionTest.php +++ b/tests/Predis/CommunicationExceptionTest.php @@ -64,7 +64,7 @@ class CommunicationExceptionTest extends PredisTestCase $connection ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $connection ->expects($this->once()) ->method('disconnect'); @@ -98,7 +98,7 @@ class CommunicationExceptionTest extends PredisTestCase $exception ->expects($this->once()) ->method('shouldResetConnection') - ->will($this->returnValue(false)); + ->willReturn(false); $this->expectException('Predis\CommunicationException'); $this->expectExceptionMessage('Communication error message'); diff --git a/tests/Predis/Configuration/Option/AggregateTest.php b/tests/Predis/Configuration/Option/AggregateTest.php index f7ae88df..db6931ca 100644 --- a/tests/Predis/Configuration/Option/AggregateTest.php +++ b/tests/Predis/Configuration/Option/AggregateTest.php @@ -50,7 +50,7 @@ class AggregateTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($connection)); + ->willReturn($connection); $this->assertInstanceOf('Closure', $initializer = $option->filter($options, $callable)); $this->assertSame($connection, $initializer($parameters = array())); @@ -77,7 +77,7 @@ class AggregateTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($connection)); + ->willReturn($connection); $this->assertInstanceOf('Closure', $initializer = $option->filter($options, $callable)); diff --git a/tests/Predis/Configuration/Option/CRC16Test.php b/tests/Predis/Configuration/Option/CRC16Test.php index b13345de..ea5d9db3 100644 --- a/tests/Predis/Configuration/Option/CRC16Test.php +++ b/tests/Predis/Configuration/Option/CRC16Test.php @@ -71,7 +71,7 @@ class CRC16Test extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($hashGenerator)); + ->willReturn($hashGenerator); $this->assertSame($hashGenerator, $option->filter($options, $callable)); } @@ -97,7 +97,7 @@ class CRC16Test extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($wrongValue)); + ->willReturn($wrongValue); $option->filter($options, $callable); } diff --git a/tests/Predis/Configuration/Option/ClusterTest.php b/tests/Predis/Configuration/Option/ClusterTest.php index 4c75d654..93ff7338 100644 --- a/tests/Predis/Configuration/Option/ClusterTest.php +++ b/tests/Predis/Configuration/Option/ClusterTest.php @@ -52,7 +52,7 @@ class ClusterTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($connection)); + ->willReturn($connection); $this->assertInstanceOf('Closure', $initializer = $option->filter($options, $callable)); $this->assertSame($connection, $initializer($parameters = array())); @@ -79,7 +79,7 @@ class ClusterTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($connection)); + ->willReturn($connection); $this->assertInstanceOf('Closure', $initializer = $option->filter($options, $callable)); diff --git a/tests/Predis/Configuration/Option/CommandsTest.php b/tests/Predis/Configuration/Option/CommandsTest.php index e197a040..68969be6 100644 --- a/tests/Predis/Configuration/Option/CommandsTest.php +++ b/tests/Predis/Configuration/Option/CommandsTest.php @@ -51,14 +51,14 @@ class CommandsTest extends PredisTestCase ->expects($this->once()) ->method('__isset') ->with('prefix') - ->will($this->returnValue(true)); + ->willReturn(true); $options ->expects($this->once()) ->method('__get') ->with('prefix') - ->will($this->returnValue( + ->willReturn( new KeyPrefixProcessor('prefix:') - )); + ); $commands = $option->getDefault($options); @@ -149,7 +149,7 @@ class CommandsTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($commands)); + ->willReturn($commands); $this->assertSame($commands, $option->filter($options, $callable)); } @@ -176,7 +176,7 @@ class CommandsTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($dictionary)); + ->willReturn($dictionary); $commands = $option->filter($options, $callable); @@ -205,9 +205,9 @@ class CommandsTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue( + ->willReturn( new \stdClass() - )); + ); $option->filter($options, $callable); } diff --git a/tests/Predis/Configuration/Option/ConnectionsTest.php b/tests/Predis/Configuration/Option/ConnectionsTest.php index c3213d73..a43c89a6 100644 --- a/tests/Predis/Configuration/Option/ConnectionsTest.php +++ b/tests/Predis/Configuration/Option/ConnectionsTest.php @@ -58,7 +58,7 @@ class ConnectionsTest extends PredisTestCase ->expects($this->once()) ->method('getDefault') ->with($options) - ->will($this->returnValue($default)); + ->willReturn($default); $this->assertInstanceOf('Predis\Connection\FactoryInterface', $factory = $option->filter($options, $value)); $this->assertSame($default, $factory); @@ -147,12 +147,12 @@ class ConnectionsTest extends PredisTestCase ->expects($this->once()) ->method('defined') ->with('parameters') - ->will($this->returnValue(true)); + ->willReturn(true); $options ->expects($this->once()) ->method('__get') ->with('parameters') - ->will($this->returnValue($parameters)); + ->willReturn($parameters); $option = new Connections(); $factory = $option->getDefault($options); @@ -196,9 +196,9 @@ class ConnectionsTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue( + ->willReturn( $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock() - )); + ); $this->assertSame($factory, $option->filter($options, $callable)); } diff --git a/tests/Predis/Configuration/Option/PrefixTest.php b/tests/Predis/Configuration/Option/PrefixTest.php index 58271acd..5aeace3c 100644 --- a/tests/Predis/Configuration/Option/PrefixTest.php +++ b/tests/Predis/Configuration/Option/PrefixTest.php @@ -82,9 +82,9 @@ class PrefixTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue( + ->willReturn( $processor = $this->getMockBuilder('Predis\Command\Processor\ProcessorInterface')->getMock() - )); + ); $prefix = $option->filter($options, $callable); @@ -108,7 +108,7 @@ class PrefixTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue('pfx:')); + ->willReturn('pfx:'); $prefix = $option->filter($options, $callable); @@ -133,7 +133,7 @@ class PrefixTest extends PredisTestCase $input ->expects($this->once()) ->method('__toString') - ->will($this->returnValue('pfx:')); + ->willReturn('pfx:'); $prefix = $option->filter($options, $input); diff --git a/tests/Predis/Configuration/Option/ReplicationTest.php b/tests/Predis/Configuration/Option/ReplicationTest.php index f7bb5e3f..241b9d33 100644 --- a/tests/Predis/Configuration/Option/ReplicationTest.php +++ b/tests/Predis/Configuration/Option/ReplicationTest.php @@ -49,12 +49,12 @@ class ReplicationTest extends PredisTestCase ->expects($this->at(0)) ->method('__get') ->with('autodiscovery') - ->will($this->returnValue(true)); + ->willReturn(true); $options ->expects($this->at(1)) ->method('__get') ->with('connections') - ->will($this->returnValue($connectionFactory)); + ->willReturn($connectionFactory); $this->assertInstanceOf('Closure', $initializer = $option->getDefault($options)); $this->assertInstanceOf('Predis\Connection\Replication\MasterSlaveReplication', $connection = $initializer($options)); @@ -84,7 +84,7 @@ class ReplicationTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($connection)); + ->willReturn($connection); $this->assertInstanceOf('Closure', $initializer = $option->filter($options, $callable)); $this->assertSame($connection, $initializer($parameters = array())); @@ -111,7 +111,7 @@ class ReplicationTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($connection)); + ->willReturn($connection); $this->assertInstanceOf('Closure', $initializer = $option->filter($options, $callable)); @@ -145,7 +145,7 @@ class ReplicationTest extends PredisTestCase ->expects($this->at(0)) ->method('__get') ->with('service') - ->will($this->returnValue('mymaster')); + ->willReturn('mymaster'); $options ->expects($this->at(1)) ->method('__get') diff --git a/tests/Predis/Configuration/OptionsTest.php b/tests/Predis/Configuration/OptionsTest.php index 7ecb33ef..2704f6c1 100644 --- a/tests/Predis/Configuration/OptionsTest.php +++ b/tests/Predis/Configuration/OptionsTest.php @@ -48,7 +48,7 @@ class OptionsTest extends PredisTestCase ->expects($this->any()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($connection)); + ->willReturn($connection); $options = new Options(array( 'exceptions' => false, @@ -168,7 +168,7 @@ class OptionsTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($commands)); + ->willReturn($commands); $options = new Options(array( 'commands' => $callable, @@ -193,7 +193,7 @@ class OptionsTest extends PredisTestCase ->expects($this->once()) ->method('__invoke') ->with($this->isInstanceOf('Predis\Configuration\OptionsInterface')) - ->will($this->returnValue($custom)); + ->willReturn($custom); $options = new Options(array( 'custom' => $callable, diff --git a/tests/Predis/Connection/Cluster/PredisClusterTest.php b/tests/Predis/Connection/Cluster/PredisClusterTest.php index a6fe68db..76519eca 100644 --- a/tests/Predis/Connection/Cluster/PredisClusterTest.php +++ b/tests/Predis/Connection/Cluster/PredisClusterTest.php @@ -140,13 +140,13 @@ class PredisClusterTest extends PredisTestCase $connection1 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $connection2 = $this->getMockConnection('tcp://127.0.0.1:7002'); $connection2 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $cluster = new PredisCluster(); @@ -165,13 +165,13 @@ class PredisClusterTest extends PredisTestCase $connection1 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $connection2 = $this->getMockConnection('tcp://127.0.0.1:7002'); $connection2 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $cluster = new PredisCluster(); diff --git a/tests/Predis/Connection/Cluster/RedisClusterTest.php b/tests/Predis/Connection/Cluster/RedisClusterTest.php index 9ca52f39..efaa622f 100644 --- a/tests/Predis/Connection/Cluster/RedisClusterTest.php +++ b/tests/Predis/Connection/Cluster/RedisClusterTest.php @@ -147,29 +147,29 @@ class RedisClusterTest extends PredisTestCase $connection1 ->expects($this->any()) ->method('connect') - ->will($this->returnCallback(function () use (&$connect1) { + ->willReturnCallback(function () use (&$connect1) { $connect1 = true; - })); + }); $connection1 ->expects($this->any()) ->method('isConnected') - ->will($this->returnCallback(function () use (&$connect1) { + ->willReturnCallback(function () use (&$connect1) { return $connect1; - })); + }); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $connection2 ->expects($this->any()) ->method('connect') - ->will($this->returnCallback(function () use (&$connect2) { + ->willReturnCallback(function () use (&$connect2) { $connect2 = true; - })); + }); $connection2 ->expects($this->any()) ->method('isConnected') - ->will($this->returnCallback(function () use (&$connect2) { + ->willReturnCallback(function () use (&$connect2) { return $connect2; - })); + }); $cluster = new RedisCluster(new Connection\Factory()); @@ -221,13 +221,13 @@ class RedisClusterTest extends PredisTestCase $connection1 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $connection2 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $cluster = new RedisCluster(new Connection\Factory()); @@ -246,13 +246,13 @@ class RedisClusterTest extends PredisTestCase $connection1 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $connection2 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $cluster = new RedisCluster(new Connection\Factory()); @@ -307,7 +307,7 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->returnValue($slotsmap)); + ->willReturn($slotsmap); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922'); $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383'); @@ -321,7 +321,7 @@ class RedisClusterTest extends PredisTestCase 'host' => '127.0.0.1', 'port' => '6383', )) - ->will($this->returnValue($connection3)); + ->willReturn($connection3); $factory ->expects($this->at(1)) ->method('create') @@ -329,7 +329,7 @@ class RedisClusterTest extends PredisTestCase 'host' => '127.0.0.1', 'port' => '6384', )) - ->will($this->returnValue($connection4)); + ->willReturn($connection4); // TODO: I'm not sure about mocking a protected method, but it'll do for now /** @var Connection\Cluster\RedisCluster|MockObject */ @@ -340,7 +340,7 @@ class RedisClusterTest extends PredisTestCase $cluster ->expects($this->once()) ->method('getRandomConnection') - ->will($this->returnValue($connection1)); + ->willReturn($connection1); $cluster->add($connection1); $cluster->add($connection2); @@ -599,9 +599,9 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'GET', array('node:1001') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($connection1, 'Unknown connection error [127.0.0.1:6381]') - )); + ); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922'); $connection2 @@ -610,7 +610,7 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->returnValue($slotsmap)); + ->willReturn($slotsmap); $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10923-16383'); $connection3 @@ -619,7 +619,7 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->returnValue($slotsmap)); + ->willReturn($slotsmap); $connection4 = $this->getMockConnection('tcp://127.0.0.1:9381'); $connection4 @@ -628,14 +628,14 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'GET', array('node:1001') )) - ->will($this->returnValue('value:1001')); + ->willReturn('value:1001'); $connection4 ->expects($this->at(1)) ->method('executeCommand') ->with($this->isRedisCommand( 'GET', array('node:5001') )) - ->will($this->returnValue('value:5001')); + ->willReturn('value:5001'); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -646,7 +646,7 @@ class RedisClusterTest extends PredisTestCase 'host' => '127.0.0.1', 'port' => '9381', )) - ->will($this->returnValue($connection4)); + ->willReturn($connection4); $cluster = new RedisCluster($factory); @@ -675,9 +675,9 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'GET', array('node:1001') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($connection1, 'Unknown connection error [127.0.0.1:6381]') - )); + ); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5501-11000'); $connection2 @@ -686,9 +686,9 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'GET', array('node:1001') )) - ->will($this->returnValue( + ->willReturn( new Response\Error('MOVED 1970 127.0.0.1:9381') - )); + ); $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=11101-16383'); $connection3 @@ -702,7 +702,7 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'GET', array('node:1001') )) - ->will($this->returnValue('value:1001')); + ->willReturn('value:1001'); $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); $factory @@ -712,7 +712,7 @@ class RedisClusterTest extends PredisTestCase 'host' => '127.0.0.1', 'port' => '9381', )) - ->will($this->returnValue($connection4)); + ->willReturn($connection4); // TODO: I'm not sure about mocking a protected method, but it'll do for now /** @var Connection\Cluster\RedisCluster|MockObject */ @@ -791,9 +791,9 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($connection1, 'Unknown connection error [127.0.0.1:6381]') - )); + ); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922'); $connection2 @@ -802,9 +802,9 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($connection2, 'Unknown connection error [127.0.0.1:6383]') - )); + ); $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10923-16383'); $connection3 @@ -813,7 +813,7 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->returnValue($slotsmap)); + ->willReturn($slotsmap); $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); $factory @@ -829,7 +829,7 @@ class RedisClusterTest extends PredisTestCase $cluster ->expects($this->exactly(3)) ->method('getRandomConnection') - ->will($this->onConsecutiveCalls($connection1, $connection2, $connection3)); + ->willReturnOnConsecutiveCalls($connection1, $connection2, $connection3); $cluster->add($connection1); $cluster->add($connection2); @@ -861,9 +861,9 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($connection1, 'Unknown connection error [127.0.0.1:6381]') - )); + ); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6382?slots=5461-10922'); $connection2 @@ -872,9 +872,9 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($connection2, 'Unknown connection error [127.0.0.1:6382]') - )); + ); $connection3 = $this->getMockConnection('tcp://127.0.0.1:6383?slots=10923-16383'); $connection3 @@ -895,7 +895,7 @@ class RedisClusterTest extends PredisTestCase $cluster ->expects($this->exactly(2)) ->method('getRandomConnection') - ->will($this->onConsecutiveCalls($connection1, $connection2)); + ->willReturnOnConsecutiveCalls($connection1, $connection2); $cluster->add($connection1); $cluster->add($connection2); @@ -946,7 +946,7 @@ class RedisClusterTest extends PredisTestCase ->expects($this->exactly(2)) ->method('executeCommand') ->with($command) - ->will($this->onConsecutiveCalls($askResponse, 'foobar')); + ->willReturnOnConsecutiveCalls($askResponse, 'foobar'); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $connection2 @@ -957,7 +957,7 @@ class RedisClusterTest extends PredisTestCase ->expects($this->at(3)) ->method('executeCommand') ->with($command) - ->will($this->returnValue('foobar')); + ->willReturn('foobar'); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -990,7 +990,7 @@ class RedisClusterTest extends PredisTestCase ->expects($this->exactly(2)) ->method('executeCommand') ->with($command) - ->will($this->onConsecutiveCalls($askResponse, 'foobar')); + ->willReturnOnConsecutiveCalls($askResponse, 'foobar'); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $connection2 @@ -1008,7 +1008,7 @@ class RedisClusterTest extends PredisTestCase ->expects($this->at(1)) ->method('executeCommand') ->with($command) - ->will($this->returnValue('foobar')); + ->willReturn('foobar'); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -1019,7 +1019,7 @@ class RedisClusterTest extends PredisTestCase 'host' => '127.0.0.1', 'port' => '6381', )) - ->will($this->returnValue($connection3)); + ->willReturn($connection3); $cluster = new RedisCluster($factory); $cluster->useClusterSlots(false); @@ -1046,14 +1046,14 @@ class RedisClusterTest extends PredisTestCase ->expects($this->exactly(1)) ->method('executeCommand') ->with($command) - ->will($this->returnValue($movedResponse)); + ->willReturn($movedResponse); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $connection2 ->expects($this->exactly(2)) ->method('executeCommand') ->with($command) - ->will($this->onConsecutiveCalls('foobar', 'foobar')); + ->willReturnOnConsecutiveCalls('foobar', 'foobar'); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -1084,7 +1084,7 @@ class RedisClusterTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($command) - ->will($this->returnValue($movedResponse)); + ->willReturn($movedResponse); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $connection2 @@ -1096,7 +1096,7 @@ class RedisClusterTest extends PredisTestCase ->expects($this->exactly(2)) ->method('executeCommand') ->with($command) - ->will($this->onConsecutiveCalls('foobar', 'foobar')); + ->willReturnOnConsecutiveCalls('foobar', 'foobar'); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -1107,7 +1107,7 @@ class RedisClusterTest extends PredisTestCase 'host' => '127.0.0.1', 'port' => '6381', )) - ->will($this->returnValue($connection3)); + ->willReturn($connection3); $cluster = new RedisCluster($factory); $cluster->useClusterSlots(false); @@ -1134,14 +1134,14 @@ class RedisClusterTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($command) - ->will($this->returnValue($movedResponse)); + ->willReturn($movedResponse); $connection2 = $this->getMockConnection('tcp://[2001:db8:0:f101::2]:6379'); $connection2 ->expects($this->once()) ->method('executeCommand') ->with($command) - ->will($this->returnValue('foobar')); + ->willReturn('foobar'); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -1152,7 +1152,7 @@ class RedisClusterTest extends PredisTestCase 'host' => '2001:db8:0:f101::2', 'port' => '6379', )) - ->will($this->returnValue($connection2)); + ->willReturn($connection2); $cluster = new RedisCluster($factory); $cluster->useClusterSlots(false); @@ -1193,7 +1193,7 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->returnValue($response)); + ->willReturn($response); /** @var Connection\FactoryInterface */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -1224,7 +1224,7 @@ class RedisClusterTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($cmdGET) - ->will($this->returnValue($rspMOVED)); + ->willReturn($rspMOVED); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $connection2 @@ -1233,12 +1233,12 @@ class RedisClusterTest extends PredisTestCase ->with($this->isRedisCommand( 'CLUSTER', array('SLOTS') )) - ->will($this->returnValue($rspSlotsArray)); + ->willReturn($rspSlotsArray); $connection2 ->expects($this->at(3)) ->method('executeCommand') ->with($cmdGET) - ->will($this->returnValue('foobar')); + ->willReturn('foobar'); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -1249,7 +1249,7 @@ class RedisClusterTest extends PredisTestCase 'host' => '127.0.0.1', 'port' => '6380', )) - ->will($this->returnValue($connection2)); + ->willReturn($connection2); $cluster = new RedisCluster($factory); diff --git a/tests/Predis/Connection/CompositeStreamConnectionTest.php b/tests/Predis/Connection/CompositeStreamConnectionTest.php index ec65ebc4..dabde31e 100644 --- a/tests/Predis/Connection/CompositeStreamConnectionTest.php +++ b/tests/Predis/Connection/CompositeStreamConnectionTest.php @@ -47,9 +47,9 @@ class CompositeStreamConnectionTest extends PredisConnectionTestCase $connection ->method('executeCommand') ->with($cmdSelect) - ->will($this->returnValue( + ->willReturn( new ErrorResponse('ERR invalid DB index') - )); + ); $connection->method('createResource'); diff --git a/tests/Predis/Connection/FactoryTest.php b/tests/Predis/Connection/FactoryTest.php index 23241265..91ea6ae1 100644 --- a/tests/Predis/Connection/FactoryTest.php +++ b/tests/Predis/Connection/FactoryTest.php @@ -302,7 +302,7 @@ class FactoryTest extends PredisTestCase $connection ->expects($this->once()) ->method('getParameters') - ->will($this->returnValue($parameters)); + ->willReturn($parameters); $connection ->expects($this->at(1)) ->method('addConnectCommand') @@ -474,7 +474,7 @@ class FactoryTest extends PredisTestCase ->expects($this->exactly(2)) ->method('__invoke') ->with($parameters, $factory) - ->will($this->returnCallback($initializer)); + ->willReturnCallback($initializer); $factory->define($parameters->scheme, $initializerMock); @@ -587,9 +587,9 @@ class FactoryTest extends PredisTestCase $factory ->expects($this->exactly(3)) ->method('create') - ->will($this->returnCallback(function () use ($connectionClass) { + ->willReturnCallback(function () use ($connectionClass) { return new $connectionClass(); - })); + }); $factory->aggregate($cluster, array(null, 'tcp://127.0.0.1', array('scheme' => 'tcp'), new $connectionClass())); } diff --git a/tests/Predis/Connection/PhpiredisSocketConnectionTest.php b/tests/Predis/Connection/PhpiredisSocketConnectionTest.php index 633f71d0..f81af990 100644 --- a/tests/Predis/Connection/PhpiredisSocketConnectionTest.php +++ b/tests/Predis/Connection/PhpiredisSocketConnectionTest.php @@ -74,9 +74,9 @@ class PhpiredisSocketConnectionTest extends PredisConnectionTestCase $connection ->method('executeCommand') ->with($cmdSelect) - ->will($this->returnValue( + ->willReturn( new ErrorResponse('ERR invalid DB index') - )); + ); $connection->method('createResource'); diff --git a/tests/Predis/Connection/PhpiredisStreamConnectionTest.php b/tests/Predis/Connection/PhpiredisStreamConnectionTest.php index fdd63938..078e25a3 100644 --- a/tests/Predis/Connection/PhpiredisStreamConnectionTest.php +++ b/tests/Predis/Connection/PhpiredisStreamConnectionTest.php @@ -74,9 +74,9 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase $connection ->method('executeCommand') ->with($cmdSelect) - ->will($this->returnValue( + ->willReturn( new ErrorResponse('ERR invalid DB index') - )); + ); $connection->method('createResource'); diff --git a/tests/Predis/Connection/Replication/MasterSlaveReplicationTest.php b/tests/Predis/Connection/Replication/MasterSlaveReplicationTest.php index d26f38b3..29970e6d 100644 --- a/tests/Predis/Connection/Replication/MasterSlaveReplicationTest.php +++ b/tests/Predis/Connection/Replication/MasterSlaveReplicationTest.php @@ -216,13 +216,13 @@ class MasterSlaveReplicationTest extends PredisTestCase $master ->expects($this->never()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $slave = $this->getMockConnection('tcp://127.0.0.1:6380?role=slave'); $slave ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $replication = new MasterSlaveReplication(); $replication->add($master); @@ -241,13 +241,13 @@ class MasterSlaveReplicationTest extends PredisTestCase $master ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $slave = $this->getMockConnection('tcp://127.0.0.1:6380?role=slave'); $slave ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $replication = new MasterSlaveReplication(); $replication->add($master); @@ -714,16 +714,16 @@ class MasterSlaveReplicationTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($cmdExists) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($slave1) - )); + ); $slave2 = $this->getMockConnection('tcp://127.0.0.1:6381?role=slave&alias=slave2'); $slave2 ->expects($this->once()) ->method('executeCommand') ->with($cmdExists) - ->will($this->returnValue(1)); + ->willReturn(1); $replication = new MasterSlaveReplication(); @@ -753,23 +753,23 @@ class MasterSlaveReplicationTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($cmdExists) - ->will($this->returnValue(1)); + ->willReturn(1); $slave1 = $this->getMockConnection('tcp://127.0.0.1:6380?role=slave'); $slave1 ->expects($this->once()) ->method('executeCommand') ->with($cmdExists) - ->will($this->throwException(new Connection\ConnectionException($slave1))); + ->willThrowException(new Connection\ConnectionException($slave1)); $slave2 = $this->getMockConnection('tcp://127.0.0.1:6381?role=slave'); $slave2 ->expects($this->once()) ->method('executeCommand') ->with($cmdExists) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($slave2) - )); + ); $replication = new MasterSlaveReplication(); @@ -799,7 +799,7 @@ class MasterSlaveReplicationTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($cmdExists) - ->will($this->returnValue(1)); + ->willReturn(1); $replication = new MasterSlaveReplication(); @@ -849,9 +849,9 @@ class MasterSlaveReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'EXISTS', array('key') )) - ->will($this->returnValue( + ->willReturn( new Response\Error('LOADING') - )); + ); $slave2 = $this->getMockConnection('tcp://127.0.0.1:6381?role=slave'); $slave2 @@ -860,7 +860,7 @@ class MasterSlaveReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'EXISTS', array('key') )) - ->will($this->returnValue(1)); + ->willReturn(1); $replication = new MasterSlaveReplication(); @@ -894,9 +894,9 @@ class MasterSlaveReplicationTest extends PredisTestCase ->expects($this->once()) ->method('executeCommand') ->with($cmdSet) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($master) - )); + ); $slave1 = $this->getMockConnection('tcp://127.0.0.1:6380?role=slave'); $slave1 @@ -1114,7 +1114,7 @@ repl_backlog_histlen:12978 'port' => '6381', 'role' => 'master', )) - ->will($this->returnValue($master)); + ->willReturn($master); $connFactory ->expects($this->at(1)) ->method('create') @@ -1123,7 +1123,7 @@ repl_backlog_histlen:12978 'port' => '6382', 'role' => 'slave', )) - ->will($this->returnValue($slave1)); + ->willReturn($slave1); $connFactory ->expects($this->at(2)) ->method('create') @@ -1132,13 +1132,13 @@ repl_backlog_histlen:12978 'port' => '6383', 'role' => 'slave', )) - ->will($this->returnValue($slave2)); + ->willReturn($slave2); $slave1 ->expects($this->once()) ->method('executeCommand') ->with($cmdInfo) - ->will($this->returnValue(' + ->willReturn(' # Replication role:slave master_host:127.0.0.1 @@ -1156,13 +1156,13 @@ repl_backlog_size:1048576 repl_backlog_first_byte_offset:0 repl_backlog_histlen:0 ' - )); + ); $master ->expects($this->once()) ->method('executeCommand') ->with($cmdInfo) - ->will($this->returnValue(' + ->willReturn(' # Replication role:master connected_slaves:2 @@ -1174,7 +1174,7 @@ repl_backlog_size:1048576 repl_backlog_first_byte_offset:2 repl_backlog_histlen:12978 ' - )); + ); $replication = new MasterSlaveReplication(); $replication->setConnectionFactory($connFactory); @@ -1213,7 +1213,7 @@ repl_backlog_histlen:12978 'port' => '6381', 'role' => 'master', )) - ->will($this->returnValue($master)); + ->willReturn($master); $connFactory ->expects($this->at(1)) ->method('create') @@ -1222,7 +1222,7 @@ repl_backlog_histlen:12978 'port' => '6382', 'role' => 'slave', )) - ->will($this->returnValue($slave1)); + ->willReturn($slave1); $connFactory ->expects($this->at(2)) ->method('create') @@ -1231,21 +1231,21 @@ repl_backlog_histlen:12978 'port' => '6383', 'role' => 'slave', )) - ->will($this->returnValue($slave2)); + ->willReturn($slave2); $masterKO ->expects($this->once()) ->method('executeCommand') ->with($cmdInfo) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($masterKO) - )); + ); $slave1 ->expects($this->once()) ->method('executeCommand') ->with($cmdInfo) - ->will($this->returnValue(' + ->willReturn(' # Replication role:slave master_host:127.0.0.1 @@ -1263,7 +1263,7 @@ repl_backlog_size:1048576 repl_backlog_first_byte_offset:0 repl_backlog_histlen:0 ' - )); + ); $master ->expects($this->once()) @@ -1338,27 +1338,27 @@ repl_backlog_histlen:12978 'port' => '6382', 'role' => 'slave', )) - ->will($this->returnValue($slave1)); + ->willReturn($slave1); $slaveKO ->expects($this->once()) ->method('executeCommand') ->with($cmdExists) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($slaveKO) - )); + ); $slave1 ->expects($this->once()) ->method('executeCommand') ->with($cmdExists) - ->will($this->returnValue(1)); + ->willReturn(1); $master ->expects($this->once()) ->method('executeCommand') ->with($cmdInfo) - ->will($this->returnValue(' + ->willReturn(' # Replication role:master connected_slaves:2 @@ -1369,7 +1369,7 @@ repl_backlog_size:1048576 repl_backlog_first_byte_offset:2 repl_backlog_histlen:12978 ' - )); + ); $replication = new MasterSlaveReplication(); $replication->setConnectionFactory($connFactory); diff --git a/tests/Predis/Connection/Replication/SentinelReplicationTest.php b/tests/Predis/Connection/Replication/SentinelReplicationTest.php index d7381fc9..c1abcd46 100644 --- a/tests/Predis/Connection/Replication/SentinelReplicationTest.php +++ b/tests/Predis/Connection/Replication/SentinelReplicationTest.php @@ -211,7 +211,7 @@ class SentinelReplicationTest extends PredisTestCase array($this->isRedisCommand('SENTINEL', array('get-master-addr-by-name', 'svc'))), array($this->isRedisCommand('SENTINEL', array('slaves', 'svc'))) ) - ->will($this->onConsecutiveCalls( + ->willReturnOnConsecutiveCalls( // SENTINEL get-master-addr-by-name svc array('127.0.0.1', '6381'), @@ -227,7 +227,7 @@ class SentinelReplicationTest extends PredisTestCase 'master-port', '6381', ), ) - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -266,7 +266,7 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('sentinels', 'svc') )) - ->will($this->returnValue( + ->willReturn( array( array( 'name', '127.0.0.1:5382', @@ -283,7 +283,7 @@ class SentinelReplicationTest extends PredisTestCase 'flags', 'sentinel', ), ) - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); $replication->updateSentinels(); @@ -314,9 +314,9 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('sentinels', 'svc') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($sentinel1, 'Unknown connection error [127.0.0.1:5381]') - )); + ); $sentinel2 = $this->getMockSentinelConnection('tcp://127.0.0.1:5382?role=sentinel&alias=sentinel2'); $sentinel2 @@ -325,7 +325,7 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('sentinels', 'svc') )) - ->will($this->returnValue( + ->willReturn( array( array( 'name', '127.0.0.1:5383', @@ -335,7 +335,7 @@ class SentinelReplicationTest extends PredisTestCase 'flags', 'sentinel', ), ) - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1, $sentinel2)); $replication->updateSentinels(); @@ -368,9 +368,9 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('sentinels', 'svc') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($sentinel1, 'Unknown connection error [127.0.0.1:5381]') - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); $replication->updateSentinels(); @@ -390,7 +390,7 @@ class SentinelReplicationTest extends PredisTestCase array($this->isRedisCommand('SENTINEL', array('get-master-addr-by-name', 'svc'))), array($this->isRedisCommand('SENTINEL', array('slaves', 'svc'))) ) - ->will($this->onConsecutiveCalls( + ->willReturnOnConsecutiveCalls( // SENTINEL sentinels svc array( array( @@ -426,7 +426,7 @@ class SentinelReplicationTest extends PredisTestCase 'master-port', '6381', ), ) - )); + ); $sentinel2 = $this->getMockSentinelConnection('tcp://127.0.0.1:5382?role=sentinel&alias=sentinel2'); @@ -471,9 +471,9 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('get-master-addr-by-name', 'svc') )) - ->will($this->returnValue( + ->willReturn( array('127.0.0.1', '6381') - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -495,9 +495,9 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('get-master-addr-by-name', 'svc') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($sentinel1, 'Unknown connection error [127.0.0.1:5381]') - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -516,7 +516,7 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('slaves', 'svc') )) - ->will($this->returnValue( + ->willReturn( array( array( 'name', '127.0.0.1:6382', @@ -537,7 +537,7 @@ class SentinelReplicationTest extends PredisTestCase 'master-port', '6381', ), ) - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -562,9 +562,9 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('slaves', 'svc') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($sentinel1, 'Unknown connection error [127.0.0.1:5381]') - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -620,7 +620,7 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('slaves', 'svc') )) - ->will($this->returnValue( + ->willReturn( array( array( 'name', '127.0.0.1:6382', @@ -632,7 +632,7 @@ class SentinelReplicationTest extends PredisTestCase 'master-port', '6381', ), ) - )); + ); $master = $this->getMockConnection('tcp://127.0.0.1:6381?role=master'); $master @@ -654,7 +654,7 @@ class SentinelReplicationTest extends PredisTestCase 'port' => '6382', 'role' => 'slave', )) - ->will($this->returnValue($slave1)); + ->willReturn($slave1); $replication = $this->getReplicationConnection('svc', array($sentinel1), $factory); @@ -675,18 +675,18 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('slaves', 'svc') )) - ->will($this->returnValue( + ->willReturn( array() - )); + ); $sentinel1 ->expects($this->at(1)) ->method('executeCommand') ->with($this->isRedisCommand( 'SENTINEL', array('get-master-addr-by-name', 'svc') )) - ->will($this->returnValue( + ->willReturn( array('127.0.0.1', '6381') - )); + ); $master = $this->getMockConnection('tcp://127.0.0.1:6381?role=master'); $master @@ -703,7 +703,7 @@ class SentinelReplicationTest extends PredisTestCase 'port' => '6381', 'role' => 'master', )) - ->will($this->returnValue($master)); + ->willReturn($master); $replication = $this->getReplicationConnection('svc', array($sentinel1), $factory); @@ -755,7 +755,7 @@ class SentinelReplicationTest extends PredisTestCase $slave1 ->expects($this->exactly(2)) ->method('isConnected') - ->will($this->onConsecutiveCalls(true, false)); + ->willReturnOnConsecutiveCalls(true, false); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -910,14 +910,14 @@ class SentinelReplicationTest extends PredisTestCase $master ->expects($this->exactly(2)) ->method('isConnected') - ->will($this->onConsecutiveCalls(false, true)); + ->willReturnOnConsecutiveCalls(false, true); $master ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand('ROLE')) - ->will($this->returnValue(array( + ->willReturn(array( 'master', 3129659, array(array('127.0.0.1', 6382, 3129242)), - ))); + )); $slave1 = $this->getMockConnection('tcp://127.0.0.1:6382?role=slave'); @@ -948,14 +948,14 @@ class SentinelReplicationTest extends PredisTestCase $slave1 ->expects($this->exactly(2)) ->method('isConnected') - ->will($this->onConsecutiveCalls(false, true)); + ->willReturnOnConsecutiveCalls(false, true); $slave1 ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand('ROLE')) - ->will($this->returnValue(array( + ->willReturn(array( 'slave', '127.0.0.1', 9000, 'connected', 3167038, - ))); + )); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -982,27 +982,27 @@ class SentinelReplicationTest extends PredisTestCase $master ->expects($this->exactly(2)) ->method('isConnected') - ->will($this->onConsecutiveCalls(false, true)); + ->willReturnOnConsecutiveCalls(false, true); $master ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand('ROLE')) - ->will($this->returnValue(array( + ->willReturn(array( 'master', 3129659, array(array('127.0.0.1', 6382, 3129242)), - ))); + )); $slave1 = $this->getMockConnection('tcp://127.0.0.1:6382?role=slave'); $slave1 ->expects($this->exactly(1)) ->method('isConnected') - ->will($this->onConsecutiveCalls(false)); + ->willReturnOnConsecutiveCalls(false); $slave1 ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand('ROLE')) - ->will($this->returnValue(array( + ->willReturn(array( 'slave', '127.0.0.1', 9000, 'connected', 3167038, - ))); + )); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -1036,14 +1036,14 @@ class SentinelReplicationTest extends PredisTestCase $master ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $master ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand('ROLE')) - ->will($this->returnValue(array( + ->willReturn(array( 'slave', '127.0.0.1', 9000, 'connected', 3167038, - ))); + )); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -1064,7 +1064,7 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('slaves', 'svc') )) - ->will($this->returnValue( + ->willReturn( array( array( 'name', '127.0.0.1:6382', @@ -1076,20 +1076,20 @@ class SentinelReplicationTest extends PredisTestCase 'master-port', '6381', ), ) - )); + ); $master = $this->getMockConnection('tcp://127.0.0.1:6381?role=master'); $master ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)); + ->willReturn(false); $master ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand('ROLE')) - ->will($this->returnValue(array( + ->willReturn(array( 'master', '0', array(), - ))); + )); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -1115,27 +1115,27 @@ class SentinelReplicationTest extends PredisTestCase $master ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $master ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand( 'SET', array('key', $cmdGetResponse) )) - ->will($this->returnValue($cmdSetResponse)); + ->willReturn($cmdSetResponse); $slave1 = $this->getMockConnection('tcp://127.0.0.1:6382?role=slave'); $slave1 ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $slave1 ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand( 'GET', array('key') )) - ->will($this->returnValue($cmdGetResponse)); + ->willReturn($cmdGetResponse); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -1158,7 +1158,7 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('slaves', 'svc') )) - ->will($this->returnValue( + ->willReturn( array( array( 'name', '127.0.0.1:6383', @@ -1170,41 +1170,41 @@ class SentinelReplicationTest extends PredisTestCase 'master-port', '6381', ), ) - )); + ); $master = $this->getMockConnection('tcp://127.0.0.1:6381?role=master'); $master ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $slave1 = $this->getMockConnection('tcp://127.0.0.1:6382?role=slave'); $slave1 ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $slave1 ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand( 'GET', array('key') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($slave1, 'Unknown connection error [127.0.0.1:6382]') - )); + ); $slave2 = $this->getMockConnection('tcp://127.0.0.1:6383?role=slave'); $slave2 ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $slave2 ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand( 'GET', array('key') )) - ->will($this->returnValue('value')); + ->willReturn('value'); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -1216,7 +1216,7 @@ class SentinelReplicationTest extends PredisTestCase 'port' => '6383', 'role' => 'slave', )) - ->will($this->returnValue($slave2)); + ->willReturn($slave2); $replication = $this->getReplicationConnection('svc', array($sentinel1), $factory); @@ -1240,37 +1240,37 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('get-master-addr-by-name', 'svc') )) - ->will($this->returnValue( + ->willReturn( array('127.0.0.1', '6391') - )); + ); $masterOld = $this->getMockConnection('tcp://127.0.0.1:6381?role=master'); $masterOld ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $masterOld ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand( 'DEL', array('key') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($masterOld, 'Unknown connection error [127.0.0.1:6381]') - )); + ); $masterNew = $this->getMockConnection('tcp://127.0.0.1:6391?role=master'); $masterNew ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $masterNew ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand( 'DEL', array('key') )) - ->will($this->returnValue(1)); + ->willReturn(1); /** @var Connection\FactoryInterface|MockObject */ $factory = $this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock(); @@ -1282,7 +1282,7 @@ class SentinelReplicationTest extends PredisTestCase 'port' => '6391', 'role' => 'master', )) - ->will($this->returnValue($masterNew)); + ->willReturn($masterNew); $replication = $this->getReplicationConnection('svc', array($sentinel1), $factory); @@ -1308,22 +1308,22 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('get-master-addr-by-name', 'svc') )) - ->will($this->returnValue(null)); + ->willReturn(null); $masterOld = $this->getMockConnection('tcp://127.0.0.1:6381?role=master'); $masterOld ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $masterOld ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand( 'DEL', array('key') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($masterOld, 'Unknown connection error [127.0.0.1:6381]') - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); @@ -1349,24 +1349,24 @@ class SentinelReplicationTest extends PredisTestCase ->with($this->isRedisCommand( 'SENTINEL', array('get-master-addr-by-name', 'svc') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($sentinel1, 'Unknown connection error [127.0.0.1:5381]') - )); + ); $master = $this->getMockConnection('tcp://127.0.0.1:6381?role=master'); $master ->expects($this->any()) ->method('isConnected') - ->will($this->returnValue(true)); + ->willReturn(true); $master ->expects($this->at(3)) ->method('executeCommand') ->with($this->isRedisCommand( 'DEL', array('key') )) - ->will($this->throwException( + ->willThrowException( new Connection\ConnectionException($master, 'Unknown connection error [127.0.0.1:6381]') - )); + ); $replication = $this->getReplicationConnection('svc', array($sentinel1)); diff --git a/tests/Predis/Connection/StreamConnectionTest.php b/tests/Predis/Connection/StreamConnectionTest.php index eb88728d..8eb04bed 100644 --- a/tests/Predis/Connection/StreamConnectionTest.php +++ b/tests/Predis/Connection/StreamConnectionTest.php @@ -47,9 +47,9 @@ class StreamConnectionTest extends PredisConnectionTestCase $connection ->method('executeCommand') ->with($cmdSelect) - ->will($this->returnValue( + ->willReturn( new ErrorResponse('ERR invalid DB index') - )); + ); $connection->method('createResource'); diff --git a/tests/Predis/Monitor/ConsumerTest.php b/tests/Predis/Monitor/ConsumerTest.php index 35fca8b2..15d21397 100644 --- a/tests/Predis/Monitor/ConsumerTest.php +++ b/tests/Predis/Monitor/ConsumerTest.php @@ -33,7 +33,7 @@ class ConsumerTest extends PredisTestCase ->expects($this->once()) ->method('supports') ->with('MONITOR') - ->will($this->returnValue(false)); + ->willReturn(false); $client = new Client(null, array('commands' => $commands)); @@ -71,7 +71,7 @@ class ConsumerTest extends PredisTestCase ->expects($this->once()) ->method('createCommand') ->with('MONITOR', array()) - ->will($this->returnValue($cmdMonitor)); + ->willReturn($cmdMonitor); $client ->expects($this->once()) ->method('executeCommand') @@ -137,7 +137,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($message)); + ->willReturn($message); $client = new Client($connection); @@ -162,7 +162,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($message)); + ->willReturn($message); $client = new Client($connection); diff --git a/tests/Predis/Pipeline/AtomicTest.php b/tests/Predis/Pipeline/AtomicTest.php index b7a0ff40..6fe3914c 100644 --- a/tests/Predis/Pipeline/AtomicTest.php +++ b/tests/Predis/Pipeline/AtomicTest.php @@ -32,14 +32,14 @@ class AtomicTest extends PredisTestCase $connection ->expects($this->exactly(2)) ->method('executeCommand') - ->will($this->onConsecutiveCalls(true, array($pong, $pong, $pong))); + ->willReturnOnConsecutiveCalls(true, array($pong, $pong, $pong)); $connection ->expects($this->exactly(3)) ->method('writeRequest'); $connection ->expects($this->at(3)) ->method('readResponse') - ->will($this->onConsecutiveCalls($queued, $queued, $queued)); + ->willReturnOnConsecutiveCalls($queued, $queued, $queued); $pipeline = new Atomic(new Client($connection)); @@ -62,7 +62,7 @@ class AtomicTest extends PredisTestCase $connection ->expects($this->exactly(2)) ->method('executeCommand') - ->will($this->onConsecutiveCalls(true, null)); + ->willReturnOnConsecutiveCalls(true, null); $pipeline = new Atomic(new Client($connection)); @@ -88,11 +88,11 @@ class AtomicTest extends PredisTestCase $connection ->expects($this->at(0)) ->method('executeCommand') - ->will($this->returnValue(true)); + ->willReturn(true); $connection ->expects($this->exactly(3)) ->method('readResponse') - ->will($this->onConsecutiveCalls($queued, $queued, $error)); + ->willReturnOnConsecutiveCalls($queued, $queued, $error); $connection ->expects($this->at(7)) ->method('executeCommand') @@ -121,7 +121,7 @@ class AtomicTest extends PredisTestCase $connection ->expects($this->once()) ->method('readResponse') - ->will($this->returnValue($error)); + ->willReturn($error); $pipeline = new Atomic(new Client($connection)); @@ -144,11 +144,11 @@ class AtomicTest extends PredisTestCase $connection ->expects($this->exactly(3)) ->method('readResponse') - ->will($this->onConsecutiveCalls($queued, $queued, $queued)); + ->willReturnOnConsecutiveCalls($queued, $queued, $queued); $connection ->expects($this->at(7)) ->method('executeCommand') - ->will($this->returnValue(array($pong, $pong, $error))); + ->willReturn(array($pong, $pong, $error)); $pipeline = new Atomic(new Client($connection, array('exceptions' => false))); diff --git a/tests/Predis/Pipeline/PipelineTest.php b/tests/Predis/Pipeline/PipelineTest.php index 40ddbdae..94fa588e 100644 --- a/tests/Predis/Pipeline/PipelineTest.php +++ b/tests/Predis/Pipeline/PipelineTest.php @@ -84,7 +84,7 @@ class PipelineTest extends PredisTestCase $connection ->expects($this->once()) ->method('readResponse') - ->will($this->returnValue($object)); + ->willReturn($object); $pipeline = new Pipeline(new Client($connection)); @@ -107,7 +107,7 @@ class PipelineTest extends PredisTestCase $connection ->expects($this->once()) ->method('readResponse') - ->will($this->returnValue($error)); + ->willReturn($error); $pipeline = new Pipeline(new Client($connection)); @@ -128,7 +128,7 @@ class PipelineTest extends PredisTestCase $connection ->expects($this->exactly(2)) ->method('readResponse') - ->will($this->returnValue($error)); + ->willReturn($error); $client = new Client($connection, array('exceptions' => false)); @@ -205,7 +205,7 @@ class PipelineTest extends PredisTestCase $connection ->expects($this->exactly(3)) ->method('readResponse') - ->will($this->returnCallback($this->getReadCallback())); + ->willReturnCallback($this->getReadCallback()); $pipeline = new Pipeline(new Client($connection)); @@ -246,7 +246,7 @@ class PipelineTest extends PredisTestCase $connection ->expects($this->exactly(4)) ->method('readResponse') - ->will($this->returnCallback($this->getReadCallback())); + ->willReturnCallback($this->getReadCallback()); $pipeline = new Pipeline(new Client($connection)); @@ -276,7 +276,7 @@ class PipelineTest extends PredisTestCase $connection ->expects($this->exactly(3)) ->method('readResponse') - ->will($this->returnValue($pong)); + ->willReturn($pong); $pipeline = new Pipeline(new Client($connection)); @@ -342,7 +342,7 @@ class PipelineTest extends PredisTestCase $connection ->expects($this->exactly(4)) ->method('readResponse') - ->will($this->returnCallback($this->getReadCallback())); + ->willReturnCallback($this->getReadCallback()); $pipeline = new Pipeline(new Client($connection)); diff --git a/tests/Predis/Protocol/Text/CompositeProtocolProcessorTest.php b/tests/Predis/Protocol/Text/CompositeProtocolProcessorTest.php index 61614163..fd47e518 100644 --- a/tests/Predis/Protocol/Text/CompositeProtocolProcessorTest.php +++ b/tests/Predis/Protocol/Text/CompositeProtocolProcessorTest.php @@ -103,7 +103,7 @@ class CompositeProtocolProcessorTest extends PredisTestCase ->expects($this->once()) ->method('serialize') ->with($command) - ->will($this->returnValue($serialized)); + ->willReturn($serialized); $protocol->write($connection, $command); } @@ -124,7 +124,7 @@ class CompositeProtocolProcessorTest extends PredisTestCase ->expects($this->once()) ->method('read') ->with($connection) - ->will($this->returnValue('bulk')); + ->willReturn('bulk'); $this->assertSame('bulk', $protocol->read($connection)); } diff --git a/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php b/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php index b848f564..18301e20 100644 --- a/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php +++ b/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php @@ -31,7 +31,7 @@ class BulkResponseTest extends PredisTestCase ->expects($this->once()) ->method('readBuffer') ->with($this->equalTo(2)) - ->will($this->returnValue("\r\n")); + ->willReturn("\r\n"); $handler = new Handler\BulkResponse(); @@ -54,7 +54,7 @@ class BulkResponseTest extends PredisTestCase ->expects($this->once()) ->method('readBuffer') ->with($this->equalTo($bulkLengh + 2)) - ->will($this->returnValue("$bulk\r\n")); + ->willReturn("$bulk\r\n"); $handler = new Handler\BulkResponse(); diff --git a/tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php b/tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php index eb68bd68..dad4ecfe 100644 --- a/tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php +++ b/tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php @@ -27,23 +27,23 @@ class MultiBulkResponseTest extends PredisTestCase $connection ->expects($this->once()) ->method('getProtocol') - ->will($this->returnValue(new CompositeProtocolProcessor())); + ->willReturn(new CompositeProtocolProcessor()); $connection ->expects($this->at(1)) ->method('readLine') - ->will($this->returnValue('$3')); + ->willReturn('$3'); $connection ->expects($this->at(2)) ->method('readBuffer') - ->will($this->returnValue("foo\r\n")); + ->willReturn("foo\r\n"); $connection ->expects($this->at(3)) ->method('readLine') - ->will($this->returnValue('$3')); + ->willReturn('$3'); $connection ->expects($this->at(4)) ->method('readBuffer') - ->will($this->returnValue("bar\r\n")); + ->willReturn("bar\r\n"); $handler = new Handler\MultiBulkResponse(); diff --git a/tests/Predis/Protocol/Text/ProtocolProcessorTest.php b/tests/Predis/Protocol/Text/ProtocolProcessorTest.php index ac58f7ee..bb77eb78 100644 --- a/tests/Predis/Protocol/Text/ProtocolProcessorTest.php +++ b/tests/Predis/Protocol/Text/ProtocolProcessorTest.php @@ -33,11 +33,11 @@ class ProtocolProcessorTest extends PredisTestCase $command ->expects($this->once()) ->method('getId') - ->will($this->returnValue('PING')); + ->willReturn('PING'); $command ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue(array())); + ->willReturn(array()); $connection = $this->getMockConnectionOfType('Predis\Connection\CompositeConnectionInterface'); $connection @@ -59,23 +59,23 @@ class ProtocolProcessorTest extends PredisTestCase $connection ->expects($this->at(0)) ->method('readLine') - ->will($this->returnValue('+OK')); + ->willReturn('+OK'); $connection ->expects($this->at(1)) ->method('readLine') - ->will($this->returnValue('-ERR error message')); + ->willReturn('-ERR error message'); $connection ->expects($this->at(2)) ->method('readLine') - ->will($this->returnValue(':2')); + ->willReturn(':2'); $connection ->expects($this->at(3)) ->method('readLine') - ->will($this->returnValue('$-1')); + ->willReturn('$-1'); $connection ->expects($this->at(4)) ->method('readLine') - ->will($this->returnValue('*-1')); + ->willReturn('*-1'); $this->assertEquals('OK', $protocol->read($connection)); $this->assertEquals('ERR error message', $protocol->read($connection)); @@ -96,7 +96,7 @@ class ProtocolProcessorTest extends PredisTestCase $connection ->expects($this->once(4)) ->method('readLine') - ->will($this->returnValue('*1')); + ->willReturn('*1'); $this->assertInstanceOf('Predis\Response\Iterator\MultiBulk', $protocol->read($connection)); } @@ -115,7 +115,7 @@ class ProtocolProcessorTest extends PredisTestCase $connection ->expects($this->once()) ->method('readLine') - ->will($this->returnValue('!')); + ->willReturn('!'); $protocol->read($connection); } diff --git a/tests/Predis/Protocol/Text/RequestSerializerTest.php b/tests/Predis/Protocol/Text/RequestSerializerTest.php index 897767d7..e1acb570 100644 --- a/tests/Predis/Protocol/Text/RequestSerializerTest.php +++ b/tests/Predis/Protocol/Text/RequestSerializerTest.php @@ -32,11 +32,11 @@ class RequestSerializerTest extends PredisTestCase $command ->expects($this->once()) ->method('getId') - ->will($this->returnValue('PING')); + ->willReturn('PING'); $command ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue(array())); + ->willReturn(array()); $result = $serializer->serialize($command); @@ -55,11 +55,11 @@ class RequestSerializerTest extends PredisTestCase $command ->expects($this->once()) ->method('getId') - ->will($this->returnValue('SET')); + ->willReturn('SET'); $command ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue(array('key', 'value'))); + ->willReturn(array('key', 'value')); $result = $serializer->serialize($command); @@ -78,11 +78,11 @@ class RequestSerializerTest extends PredisTestCase $command ->expects($this->once()) ->method('getId') - ->will($this->returnValue('DEL')); + ->willReturn('DEL'); $command ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue(array(0 => 'key:1', 2 => 'key:2'))); + ->willReturn(array(0 => 'key:1', 2 => 'key:2')); $result = $serializer->serialize($command); diff --git a/tests/Predis/Protocol/Text/ResponseReaderTest.php b/tests/Predis/Protocol/Text/ResponseReaderTest.php index 4ccdc6ef..caec84d8 100644 --- a/tests/Predis/Protocol/Text/ResponseReaderTest.php +++ b/tests/Predis/Protocol/Text/ResponseReaderTest.php @@ -58,23 +58,23 @@ class ResponseReaderTest extends PredisTestCase $connection ->expects($this->at(0)) ->method('readLine') - ->will($this->returnValue('+OK')); + ->willReturn('+OK'); $connection ->expects($this->at(1)) ->method('readLine') - ->will($this->returnValue('-ERR error message')); + ->willReturn('-ERR error message'); $connection ->expects($this->at(2)) ->method('readLine') - ->will($this->returnValue(':2')); + ->willReturn(':2'); $connection ->expects($this->at(3)) ->method('readLine') - ->will($this->returnValue('$-1')); + ->willReturn('$-1'); $connection ->expects($this->at(4)) ->method('readLine') - ->will($this->returnValue('*-1')); + ->willReturn('*-1'); $reader = new ResponseReader(); @@ -97,7 +97,7 @@ class ResponseReaderTest extends PredisTestCase $connection ->expects($this->once()) ->method('readLine') - ->will($this->returnValue('')); + ->willReturn(''); $reader = new ResponseReader(); $reader->read($connection); @@ -115,7 +115,7 @@ class ResponseReaderTest extends PredisTestCase $connection ->expects($this->once()) ->method('readLine') - ->will($this->returnValue('!')); + ->willReturn('!'); $reader = new ResponseReader(); $reader->read($connection); diff --git a/tests/Predis/PubSub/ConsumerTest.php b/tests/Predis/PubSub/ConsumerTest.php index a64d6884..32c7c2d2 100644 --- a/tests/Predis/PubSub/ConsumerTest.php +++ b/tests/Predis/PubSub/ConsumerTest.php @@ -32,7 +32,7 @@ class ConsumerTest extends PredisTestCase $commands ->expects($this->any()) ->method('supports') - ->will($this->returnValue(false)); + ->willReturn(false); $client = new Client(null, array('commands' => $commands)); @@ -92,9 +92,9 @@ class ConsumerTest extends PredisTestCase ->expects($this->exactly(2)) ->method('createCommand') ->with($this->logicalOr($this->equalTo('subscribe'), $this->equalTo('psubscribe'))) - ->will($this->returnCallback(function ($id, $args) use ($commands) { + ->willReturnCallback(function ($id, $args) use ($commands) { return $commands->create($id, $args); - })); + }); $options = array('subscribe' => 'channel:foo', 'psubscribe' => 'channels:*'); @@ -185,7 +185,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($rawmessage)); + ->willReturn($rawmessage); $client = new Client($connection); $pubsub = new PubSubConsumer($client, array('subscribe' => 'channel:foo')); @@ -206,7 +206,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($rawmessage)); + ->willReturn($rawmessage); $client = new Client($connection); $pubsub = new PubSubConsumer($client, array('subscribe' => 'channel:foo')); @@ -227,7 +227,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($rawmessage)); + ->willReturn($rawmessage); $client = new Client($connection); $pubsub = new PubSubConsumer($client, array('subscribe' => 'channel:foo')); @@ -249,7 +249,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($rawmessage)); + ->willReturn($rawmessage); $client = new Client($connection); $pubsub = new PubSubConsumer($client, array('psubscribe' => 'channel:*')); @@ -272,7 +272,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($rawmessage)); + ->willReturn($rawmessage); $client = new Client($connection); $pubsub = new PubSubConsumer($client, array('subscribe' => 'channel:foo')); @@ -294,7 +294,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($rawmessage)); + ->willReturn($rawmessage); $client = new Client($connection); $pubsub = new PubSubConsumer($client, array('subscribe' => 'channel:foo')); @@ -316,7 +316,7 @@ class ConsumerTest extends PredisTestCase $connection ->expects($this->once()) ->method('read') - ->will($this->returnValue($rawmessage)); + ->willReturn($rawmessage); $client = new Client($connection); $pubsub = new PubSubConsumer($client, array('subscribe' => 'channel:foo')); diff --git a/tests/Predis/PubSub/DispatcherLoopTest.php b/tests/Predis/PubSub/DispatcherLoopTest.php index 65a2823f..1f893f7c 100644 --- a/tests/Predis/PubSub/DispatcherLoopTest.php +++ b/tests/Predis/PubSub/DispatcherLoopTest.php @@ -56,11 +56,11 @@ class DispatcherLoopTest extends PredisTestCase $this->equalTo('01:argument'), $this->equalTo('01:quit') ), $dispatcher) - ->will($this->returnCallback(function ($arg, $dispatcher) { + ->willReturnCallback(function ($arg, $dispatcher) { if ($arg === '01:quit') { $dispatcher->stop(); } - })); + }); $function02 = $this->getMockBuilder('stdClass') ->addMethods(array('__invoke')) @@ -122,9 +122,9 @@ class DispatcherLoopTest extends PredisTestCase ->expects($this->exactly(1)) ->method('__invoke') ->with($this->equalTo('arg:prefixed'), $dispatcher) - ->will($this->returnCallback(function ($arg, $dispatcher) { + ->willReturnCallback(function ($arg, $dispatcher) { $dispatcher->stop(); - })); + }); $dispatcher->attachCallback('callback', $callback); diff --git a/tests/Predis/Replication/ReplicationStrategyTest.php b/tests/Predis/Replication/ReplicationStrategyTest.php index cab84178..a3a16b4d 100644 --- a/tests/Predis/Replication/ReplicationStrategyTest.php +++ b/tests/Predis/Replication/ReplicationStrategyTest.php @@ -221,7 +221,7 @@ class ReplicationStrategyTest extends PredisTestCase $command ->expects($this->any()) ->method('getId') - ->will($this->returnValue('CMDTEST')); + ->willReturn('CMDTEST'); $this->assertFalse($strategy->isReadOperation($command)); } @@ -238,7 +238,7 @@ class ReplicationStrategyTest extends PredisTestCase $command ->expects($this->any()) ->method('getId') - ->will($this->returnValue('CMDTEST')); + ->willReturn('CMDTEST'); $strategy->setCommandReadOnly('CMDTEST', true); $this->assertTrue($strategy->isReadOperation($command)); @@ -256,7 +256,7 @@ class ReplicationStrategyTest extends PredisTestCase $command ->expects($this->any()) ->method('getId') - ->will($this->returnValue('CMDTEST')); + ->willReturn('CMDTEST'); $strategy->setCommandReadOnly('CMDTEST', false); $this->assertFalse($strategy->isReadOperation($command)); @@ -322,7 +322,7 @@ class ReplicationStrategyTest extends PredisTestCase $command ->expects($this->any()) ->method('getScript') - ->will($this->returnValue($script = 'return true')); + ->willReturn($script = 'return true'); $strategy->setScriptReadOnly($script, function (CommandInterface $command) { return $command->getArgument(2) === true; @@ -349,7 +349,7 @@ class ReplicationStrategyTest extends PredisTestCase $command ->expects($this->any()) ->method('getScript') - ->will($this->returnValue($script = 'return true')); + ->willReturn($script = 'return true'); $command->setArguments(array('trigger', false)); diff --git a/tests/Predis/Transaction/MultiExecTest.php b/tests/Predis/Transaction/MultiExecTest.php index b4877067..71cf465a 100644 --- a/tests/Predis/Transaction/MultiExecTest.php +++ b/tests/Predis/Transaction/MultiExecTest.php @@ -37,7 +37,7 @@ class MultiExecTest extends PredisTestCase ->expects($this->once()) ->method('supports') ->with('MULTI', 'EXEC', 'DISCARD') - ->will($this->returnValue(false)); + ->willReturn(false); $connection = $this->getMockBuilder('Predis\Connection\NodeConnectionInterface')->getMock(); $client = new Client($connection, array('commands' => $commands)); @@ -844,7 +844,7 @@ class MultiExecTest extends PredisTestCase $connection ->expects($this->any()) ->method('executeCommand') - ->will($this->returnCallback($executeCallback)); + ->willReturnCallback($executeCallback); return $connection; }