File tree 1 file changed +27
-7
lines changed
src/Symfony/Component/Cache/Tests/Traits 1 file changed +27
-7
lines changed Original file line number Diff line number Diff line change 17
17
18
18
class RedisTraitTest extends TestCase
19
19
{
20
- public static function setUpBeforeClass (): void
21
- {
22
- if (!getenv ('REDIS_CLUSTER_HOSTS ' )) {
23
- throw new SkippedTestSuiteError ('REDIS_CLUSTER_HOSTS env var is not defined. ' );
24
- }
25
- }
26
-
27
20
/**
28
21
* @dataProvider provideCreateConnection
29
22
*/
@@ -65,4 +58,31 @@ public static function provideCreateConnection(): array
65
58
],
66
59
];
67
60
}
61
+
62
+ public function testClearUsesValidType (): void
63
+ {
64
+ if (!class_exists (\Redis::class)) {
65
+ throw new SkippedTestSuiteError (sprintf ('The "%s" class is required. ' , \Redis::class));
66
+ }
67
+ $ redisMock = $ this ->getMockBuilder (\Redis::class)
68
+ ->disableOriginalConstructor ()
69
+ ->getMock ();
70
+ $ redisMock ->method ('info ' )->willReturn (['redis_version ' => '3.0.0 ' ]);
71
+ $ redisMock ->expects (self ::once ())
72
+ ->method ('scan ' )
73
+ ->with (null , 'some-namespace* ' , 1000 , 'string ' )
74
+ ->willReturn ([0 , []]);
75
+ $ mock = new class ($ redisMock ) {
76
+ use RedisTrait {
77
+ doClear as public ;
78
+ }
79
+
80
+ public function __construct ($ redis )
81
+ {
82
+ $ this ->redis = $ redis ;
83
+ }
84
+ };
85
+
86
+ $ mock ->doClear ('some-namespace ' );
87
+ }
68
88
}
You can’t perform that action at this time.
0 commit comments