mirror of
https://github.com/predis/predis.git
synced 2026-10-06 20:09:25 +00:00
Client set name and version on connection (#1347)
* Added client metadata on server connection * Added try...catch around server exception to supress CLIENT command errors * Added exclusion for Relay connection
This commit is contained in:
committed by
GitHub
parent
a3311d6869
commit
4172d2265f
@@ -13,6 +13,7 @@
|
||||
namespace Predis\Connection;
|
||||
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Predis\Client;
|
||||
use Predis\Command\RawCommand;
|
||||
use Predis\Response\Error as ErrorResponse;
|
||||
|
||||
@@ -195,4 +196,22 @@ class StreamConnectionTest extends PredisConnectionTestCase
|
||||
$this->assertArrayHasKey('tcp_nodelay', $options['socket']);
|
||||
$this->assertFalse($options['socket']['tcp_nodelay']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
* @requiresRedisVersion < 7.0.0
|
||||
*/
|
||||
public function testConnectDoNotThrowsExceptionOnClientCommandError(): void
|
||||
{
|
||||
$connection = $this->createConnectionWithParams([]);
|
||||
$connection->addConnectCommand(
|
||||
new RawCommand('CLIENT', ['SETINFO', 'LIB-NAME', 'predis'])
|
||||
);
|
||||
$connection->addConnectCommand(
|
||||
new RawCommand('CLIENT', ['SETINFO', 'LIB-VER', Client::VERSION])
|
||||
);
|
||||
|
||||
$connection->connect();
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user