Remove useless argument in Predis\Client::getClientBy().

There was no real meaning to have a callback here, for the most part it
was just a leftover of a previous approach implemented with ee7104d and
quickly superseded by the current approach that simply returns the new
client instance instead of using callbacks.

From feedback to #644.
This commit is contained in:
Daniele Alessandri
2020-08-21 10:17:02 +02:00
parent 4b2b35202a
commit 5a7548bc81
2 changed files with 26 additions and 45 deletions
-27
View File
@@ -725,33 +725,6 @@ class ClientTest extends PredisTestCase
$this->assertInstanceOf('SubclassedClient', $client->getClientBy('alias', 'node02'));
}
/**
* @group disconnected
*/
public function testGetClientByMethodInvokesCallableInSecondArgumentAndReturnsItsReturnValue()
{
$test = $this;
$client = new Client(array('tcp://host1?alias=node01', 'tcp://host2?alias=node02'), array('cluster' => 'predis'));
$callable = $this->getMockBuilder('stdClass')
->setMethods(array('__invoke'))
->getMock();
$callable
->expects($this->once())
->method('__invoke')
->with($this->callback(function ($clientNode) use ($test, $client) {
$test->isInstanceOf('Predis\ClientInterface', $clientNode);
$test->assertNotSame($client, $clientNode);
$test->assertInstanceOf('Predis\Connection\NodeConnectionInterface', $connection = $clientNode->getConnection());
$test->assertSame('node02', $connection->getParameters()->alias);
return true;
}))
->will($this->returnValue('value'));
$this->assertSame('value', $client->getClientBy('alias', 'node02', $callable));
}
/**
* @group disconnected
*/