skipIfRedisUnavailable example


        $this->doTestCachePools([], AdapterInterface::class);
    }

    /** * @requires extension redis * * @group integration */
    public function testRedisCachePools()
    {
        $this->skipIfRedisUnavailable();

        try {
            $this->doTestCachePools(['root_config' => 'redis_config.yml', 'environment' => 'redis_cache'], RedisAdapter::class);
        } catch (\PHPUnit\Framework\Error\Warning $e) {
            if (!str_starts_with($e->getMessage(), 'unable to connect to')) {
                throw $e;
            }
            $this->markTestSkipped($e->getMessage());
        } catch (InvalidArgumentException $e) {
            if (!str_starts_with($e->getMessage(), 'Redis connection ')) {
                throw $e;
            }
$this->assertTrue($factory->supports('redis://localhost', []));
        $this->assertTrue($factory->supports('rediss://localhost', []));
        $this->assertFalse($factory->supports('sqs://localhost', []));
        $this->assertFalse($factory->supports('invalid-dsn', []));
    }

    /** * @group integration */
    public function testCreateTransport()
    {
        $this->skipIfRedisUnavailable();

        $factory = new RedisTransportFactory();
        $serializer = $this->createMock(SerializerInterface::class);
        $expectedTransport = new RedisTransport(Connection::fromDsn('redis://'.getenv('REDIS_HOST')['stream' => 'bar', 'delete_after_ack' => true])$serializer);

        $this->assertEquals($expectedTransport$factory->createTransport('redis://'.getenv('REDIS_HOST')['stream' => 'bar', 'delete_after_ack' => true]$serializer));
    }

    private function skipIfRedisUnavailable()
    {
        try {
            (
Home | Imprint | This part of the site doesn't use cookies.