name: ConnectionTest class_comment: '# * @requires extension redis' dependencies: - name: TestCase type: class source: PHPUnit\Framework\TestCase - name: Connection type: class source: Symfony\Component\Messenger\Bridge\Redis\Transport\Connection - name: TransportException type: class source: Symfony\Component\Messenger\Exception\TransportException properties: [] methods: - name: testAuth visibility: public parameters: - name: expected - name: dsn comment: "# * @requires extension redis\n# */\n# class ConnectionTest extends TestCase\n\ # {\n# public function testFromInvalidDsn()\n# {\n# $this->expectException(\\\ InvalidArgumentException::class);\n# $this->expectExceptionMessage('The given\ \ Redis DSN is invalid.');\n# \n# Connection::fromDsn('redis://');\n# }\n# \n\ # public function testFromDsn()\n# {\n# $this->assertEquals(\n# new Connection([\n\ # 'stream' => 'queue',\n# 'host' => 'localhost',\n# 'port' => 6379,\n# ], $this->createMock(\\\ Redis::class)),\n# Connection::fromDsn('redis://localhost/queue?', [], $this->createMock(\\\ Redis::class))\n# );\n# }\n# \n# public function testFromDsnOnUnixSocket()\n#\ \ {\n# $this->assertEquals(\n# new Connection([\n# 'stream' => 'queue',\n# 'host'\ \ => '/var/run/redis/redis.sock',\n# 'port' => 0,\n# ], $redis = $this->createMock(\\\ Redis::class)),\n# Connection::fromDsn('redis:///var/run/redis/redis.sock', ['stream'\ \ => 'queue'], $redis)\n# );\n# }\n# \n# public function testFromDsnWithOptions()\n\ # {\n# $this->assertEquals(\n# Connection::fromDsn('redis://localhost', ['stream'\ \ => 'queue', 'group' => 'group1', 'consumer' => 'consumer1', 'auto_setup' =>\ \ false, 'serializer' => 2], $this->createMock(\\Redis::class)),\n# Connection::fromDsn('redis://localhost/queue/group1/consumer1?serializer=2&auto_setup=0',\ \ [], $this->createMock(\\Redis::class))\n# );\n# }\n# \n# public function testFromDsnWithOptionsAndTrailingSlash()\n\ # {\n# $this->assertEquals(\n# Connection::fromDsn('redis://localhost/', ['stream'\ \ => 'queue', 'group' => 'group1', 'consumer' => 'consumer1', 'auto_setup' =>\ \ false, 'serializer' => 2], $this->createMock(\\Redis::class)),\n# Connection::fromDsn('redis://localhost/queue/group1/consumer1?serializer=2&auto_setup=0',\ \ [], $this->createMock(\\Redis::class))\n# );\n# }\n# \n# public function testFromDsnWithRedissScheme()\n\ # {\n# $redis = $this->createMock(\\Redis::class);\n# $redis->expects($this->once())\n\ # ->method('connect')\n# ->with('tls://127.0.0.1', 6379)\n# ->willReturn(true);\n\ # \n# Connection::fromDsn('rediss://127.0.0.1', [], $redis);\n# }\n# \n# public\ \ function testFromDsnWithQueryOptions()\n# {\n# $this->assertEquals(\n# new Connection([\n\ # 'stream' => 'queue',\n# 'group' => 'group1',\n# 'consumer' => 'consumer1',\n\ # 'host' => 'localhost',\n# 'port' => 6379,\n# 'serializer' => 2,\n# ], $this->createMock(\\\ Redis::class)),\n# Connection::fromDsn('redis://localhost/queue/group1/consumer1?serializer=2',\ \ [], $this->createMock(\\Redis::class))\n# );\n# }\n# \n# public function testFromDsnWithMixDsnQueryOptions()\n\ # {\n# $this->assertEquals(\n# Connection::fromDsn('redis://localhost/queue/group1?serializer=2',\ \ ['consumer' => 'specific-consumer'], $this->createMock(\\Redis::class)),\n#\ \ Connection::fromDsn('redis://localhost/queue/group1/specific-consumer?serializer=2',\ \ [], $this->createMock(\\Redis::class))\n# );\n# \n# $this->assertEquals(\n#\ \ Connection::fromDsn('redis://localhost/queue/group1/consumer1', ['consumer'\ \ => 'specific-consumer'], $this->createMock(\\Redis::class)),\n# Connection::fromDsn('redis://localhost/queue/group1/consumer1',\ \ [], $this->createMock(\\Redis::class))\n# );\n# }\n# \n# public function testRedisClusterInstanceIsSupported()\n\ # {\n# $redis = $this->createMock(\\RedisCluster::class);\n# $this->assertInstanceOf(Connection::class,\ \ new Connection([], $redis));\n# }\n# \n# public function testKeepGettingPendingMessages()\n\ # {\n# $redis = $this->createMock(\\Redis::class);\n# \n# $redis->expects($this->exactly(3))->method('xreadgroup')\n\ # ->with('symfony', 'consumer', ['queue' => 0], 1, 1)\n# ->willReturn(['queue'\ \ => [['message' => json_encode(['body' => 'Test', 'headers' => []])]]]);\n# \n\ # $connection = Connection::fromDsn('redis://localhost/queue', [], $redis);\n\ # $this->assertNotNull($connection->get());\n# $this->assertNotNull($connection->get());\n\ # $this->assertNotNull($connection->get());\n# }\n# \n# /**\n# * @dataProvider\ \ provideAuthDsn" - name: provideAuthDsn visibility: public parameters: [] comment: null - name: testAuthFromOptions visibility: public parameters: [] comment: null - name: testAuthFromOptionsAndDsn visibility: public parameters: [] comment: null - name: testNoAuthWithEmptyPassword visibility: public parameters: [] comment: null - name: testAuthZeroPassword visibility: public parameters: [] comment: null - name: testFailedAuth visibility: public parameters: [] comment: null - name: testGetPendingMessageFirst visibility: public parameters: [] comment: null - name: testClaimAbandonedMessageWithRaceCondition visibility: public parameters: [] comment: null - name: testClaimAbandonedMessage visibility: public parameters: [] comment: null - name: testUnexpectedRedisError visibility: public parameters: [] comment: null - name: testMaxEntries visibility: public parameters: [] comment: null - name: testDeleteAfterAck visibility: public parameters: [] comment: null - name: testDeleteAfterReject visibility: public parameters: [] comment: null - name: testLastErrorGetsCleared visibility: public parameters: [] comment: null - name: testAddReturnId visibility: public parameters: - name: expected - name: delay - name: method - name: return comment: '# * @dataProvider provideIdPatterns' - name: provideIdPatterns visibility: public parameters: [] comment: null - name: testInvalidSentinelMasterName visibility: public parameters: [] comment: null - name: testFromDsnOnUnixSocketWithUserAndPassword visibility: public parameters: [] comment: null - name: testFromDsnOnUnixSocketWithPassword visibility: public parameters: [] comment: null - name: testFromDsnOnUnixSocketWithUser visibility: public parameters: [] comment: null traits: - PHPUnit\Framework\TestCase - Symfony\Component\Messenger\Bridge\Redis\Transport\Connection - Symfony\Component\Messenger\Exception\TransportException interfaces: []