|
19 | 19 | class RedisProxiesTest extends TestCase
|
20 | 20 | {
|
21 | 21 | /**
|
22 |
| - * @requires extension redis |
| 22 | + * @requires extension redis < 6 |
23 | 23 | *
|
24 | 24 | * @testWith ["Redis"]
|
25 | 25 | * ["RedisCluster"]
|
@@ -85,19 +85,24 @@ public function testRelayProxy()
|
85 | 85 | */
|
86 | 86 | public function testRedis6Proxy($class, $stub)
|
87 | 87 | {
|
88 |
| - $this->markTestIncomplete('To be re-enabled when phpredis v6 becomes stable'); |
89 |
| - |
90 |
| - $stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/develop/{$stub}.stub.php"); |
91 |
| - $stub = preg_replace('/^class /m', 'return; \0', $stub); |
92 |
| - $stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1); |
93 |
| - $stub = preg_replace('/^ public const .*/m', '', $stub); |
94 |
| - eval(substr($stub, 5)); |
| 88 | + if (version_compare(phpversion('redis'), '6.0.0', '<')) { |
| 89 | + $this->markTestIncomplete('To be re-enabled when phpredis v6 becomes stable'); |
| 90 | + |
| 91 | + $stub = file_get_contents("https://raw.githubusercontent.com/phpredis/phpredis/develop/{$stub}.stub.php"); |
| 92 | + $stub = preg_replace('/^class /m', 'return; \0', $stub); |
| 93 | + $stub = preg_replace('/^return; class ([a-zA-Z]++)/m', 'interface \1StubInterface', $stub, 1); |
| 94 | + $stub = preg_replace('/^ public const .*/m', '', $stub); |
| 95 | + eval(substr($stub, 5)); |
| 96 | + $r = new \ReflectionClass($class.'StubInterface'); |
| 97 | + } else { |
| 98 | + $r = new \ReflectionClass($class); |
| 99 | + } |
95 | 100 |
|
96 | 101 | $proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}6Proxy.php");
|
97 | 102 | $proxy = substr($proxy, 0, 4 + strpos($proxy, '[];'));
|
98 | 103 | $methods = [];
|
99 | 104 |
|
100 |
| - foreach ((new \ReflectionClass($class.'StubInterface'))->getMethods() as $method) { |
| 105 | + foreach ($r->getMethods() as $method) { |
101 | 106 | if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name)) {
|
102 | 107 | continue;
|
103 | 108 | }
|
|
0 commit comments