forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRedisConnectionTest.php
More file actions
40 lines (33 loc) · 1.1 KB
/
RedisConnectionTest.php
File metadata and controls
40 lines (33 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
class RedisConnectionTest extends PHPUnit_Framework_TestCase
{
public function testRedisNotCreateClusterAndOptionsServer()
{
$redis = $this->getRedis(false);
$client = $redis->connection('cluster');
$this->assertNull($client, 'cluster parameter should not create as redis server');
$client = $redis->connection('options');
$this->assertNull($client, 'options parameter should not create as redis server');
}
public function testRedisClusterNotCreateClusterAndOptionsServer()
{
$redis = $this->getRedis(true);
$client = $redis->connection();
$this->assertEquals(1, $client->getConnection()->count());
}
protected function getRedis($cluster = false)
{
$servers = [
'cluster' => $cluster,
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
'options' => [
'prefix' => 'prefix:',
],
];
return new Illuminate\Redis\Database($servers);
}
}