@@ -21,6 +21,54 @@ protected function setUp(): void
2121 $ this ->keyOptional = 'KeysOptional ' ;
2222 }
2323
24+ /** @test */
25+ public function redis_keys_restore_string_key ()
26+ {
27+ // Start from scratch
28+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->key ));
29+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->keyOptional ));
30+ $ this ->assertTrue ($ this ->redis ->set ($ this ->key , 'value ' ));
31+ $ value = $ this ->redis ->dump ($ this ->key );
32+ // -------------------- T E S T --------------------
33+ $ this ->assertTrue ($ this ->redis ->restore ($ this ->keyOptional , 0 , $ value ));
34+ // -------------------- T E S T --------------------
35+ $ this ->assertEquals ('value ' , $ this ->redis ->get ($ this ->keyOptional ));
36+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->key ));
37+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->keyOptional ));
38+ }
39+
40+ /** @test */
41+ public function redis_keys_restore_int_key ()
42+ {
43+ // Start from scratch
44+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->key ));
45+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->keyOptional ));
46+ $ this ->assertTrue ($ this ->redis ->set ($ this ->key , 123 ));
47+ $ value = $ this ->redis ->dump ($ this ->key );
48+ // -------------------- T E S T --------------------
49+ $ this ->assertTrue ($ this ->redis ->restore ($ this ->keyOptional , 0 , $ value ));
50+ // -------------------- T E S T --------------------
51+ $ this ->assertEquals (123 , $ this ->redis ->get ($ this ->keyOptional ));
52+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->key ));
53+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->keyOptional ));
54+ }
55+
56+ /** @test */
57+ public function redis_keys_restore_float_key ()
58+ {
59+ // Start from scratch
60+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->key ));
61+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->keyOptional ));
62+ $ this ->assertTrue ($ this ->redis ->set ($ this ->key , 123.456 ));
63+ $ value = $ this ->redis ->dump ($ this ->key );
64+ // -------------------- T E S T --------------------
65+ $ this ->assertTrue ($ this ->redis ->restore ($ this ->keyOptional , 0 , $ value ));
66+ // -------------------- T E S T --------------------
67+ $ this ->assertEquals (123.456 , $ this ->redis ->get ($ this ->keyOptional ));
68+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->key ));
69+ $ this ->assertGreaterThanOrEqual (0 , $ this ->redis ->delete ($ this ->keyOptional ));
70+ }
71+
2472 /** @test */
2573 public function redis_keys_type_string ()
2674 {
0 commit comments