* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Cache\Tests\Simple; use Symfony\Component\Cache\Simple\RedisCache; class RedisCacheTest extends AbstractRedisCacheTest { public static function setupBeforeClass() { parent::setupBeforeClass(); self::$redis = RedisCache::createConnection('redis://'.getenv('REDIS_HOST')); } public function testCreateConnection() { $redisHost = getenv('REDIS_HOST'); $redis = RedisCache::createConnection('redis://'.$redisHost); $this->assertInstanceOf(\Redis::class, $redis); $this->assertTrue($redis->isConnected()); $this->assertSame(0, $redis->getDbNum()); $redis = RedisCache::createConnection('redis://'.$redisHost.'/2'); $this->assertSame(2, $redis->getDbNum()); $redis = RedisCache::createConnection('redis://'.$redisHost, array('timeout' => 3)); $this->assertEquals(3, $redis->getTimeout()); $redis = RedisCache::createConnection('redis://'.$redisHost.'?timeout=4'); $this->assertEquals(4, $redis->getTimeout()); $redis = RedisCache::createConnection('redis://'.$redisHost, array('read_timeout' => 5)); $this->assertEquals(5, $redis->getReadTimeout()); } /** * @dataProvider provideFailedCreateConnection * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException * @expectedExceptionMessage Redis connection failed */ public function testFailedCreateConnection($dsn) { RedisCache::createConnection($dsn); } public function provideFailedCreateConnection() { return array( array('redis://localhost:1234'), array('redis://foo@localhost'), array('redis://localhost/123'), ); } /** * @dataProvider provideInvalidCreateConnection * @expectedException \Symfony\Component\Cache\Exception\InvalidArgumentException * @expectedExceptionMessage Invalid Redis DSN */ public function testInvalidCreateConnection($dsn) { RedisCache::createConnection($dsn); } public function provideInvalidCreateConnection() { return array( array('foo://localhost'), array('redis://'), ); } } __halt_compiler();----SIGNATURE:----rgyegcE07hYDpT2fBkBi3gPm3O1OWKRj6dojtFyOdlmQ0jQal/BJ9uhCIAhT54+mZ/EZOzvZ5Lpk8iRaMPvXTU/GRgJlCv4a34pkcPh5Xt3rtdyIWmmrnxfBQxEME1kMw8DTE5ObN1C7OaOE4oNYrmcxExxRM8Wisjo/eMoZ1bF7cGp+BzrWsgWXKkNQBdp83lrsxkfp83bZIoO6Pj+tdmKYH3SzXpJOGjm/PXaZ6x8vBgURUuzoyt48bUBYDeoCBIbtEDknxnXz6sAy1A/cXa1g5DqhrCzz92AUIffrXMOY9qFYqbZXJUue56z3/za0egqlMxSP/wVsTaqOVyxVnZ2UAjCFuZ4+OaJFXQ5PLuzHbkEfuJwyuSHtA1oOQrezP9asSZBrQKznzWYrFcOZFKehmqUQTDTlgUKm5+VaDeOSIJKlSX+vjHOPS/RR492o1kJGx6I1lyEC6kbtBeDyjfP6lPIKbCn9wynZJFdZvLe9RUymFjqksfGSt+rXIh2cJe6SMf1NS67LHgS0oQwssYpXfb/SuvnobBNAJQyI9Ej/DsAobam+LH8ntuImVooDeLzOfbJmpw+1IgPTe8DFoVxFw6WGznZKChbIgVVFBa/kVebvvjWCzfUmZ9a1IMy9adORPlt0zGk64LnOeXen7y/ZRRZtGykQuJf/+Y3kaCI=----ATTACHMENT:----MTkxMzkyOTk4Njg5NTkyMSA3MzQzNTAxNzk3Mzg4MzE5IDIxMjg0NTY5NjM4OTQ2NTc=