@@ -2457,6 +2457,55 @@ public function testInfo() {
2457
2457
$ this ->assertTrue (is_array ($ res ) && isset ($ res ['redis_version ' ]) && isset ($ res ['used_memory ' ]));
2458
2458
}
2459
2459
2460
+ private function execHello () {
2461
+ $ zipped = [];
2462
+
2463
+ $ result = $ this ->redis ->rawCommand ('HELLO ' );
2464
+ if ( ! is_array ($ result ) || count ($ result ) % 2 != 0 )
2465
+ return false ;
2466
+
2467
+ for ($ i = 0 ; $ i < count ($ result ); $ i += 2 ) {
2468
+ $ zipped [$ result [$ i ]] = $ result [$ i + 1 ];
2469
+ }
2470
+
2471
+ return $ zipped ;
2472
+ }
2473
+
2474
+ public function testServerInfo () {
2475
+ if ( ! $ this ->minVersionCheck ('6.0.0 ' ))
2476
+ $ this ->markTestSkipped ();
2477
+
2478
+ $ hello = $ this ->execHello ();
2479
+ if ( ! $ this ->assertArrayKey ($ hello , 'server ' ) ||
2480
+ ! $ this ->assertArrayKey ($ hello , 'version ' ))
2481
+ {
2482
+ return false ;
2483
+ }
2484
+
2485
+ $ this ->assertEquals ($ hello ['server ' ], $ this ->redis ->serverName ());
2486
+ $ this ->assertEquals ($ hello ['version ' ], $ this ->redis ->serverVersion ());
2487
+
2488
+ $ info = $ this ->redis ->info ();
2489
+ $ cmd1 = $ info ['total_commands_processed ' ];
2490
+
2491
+ /* Shouldn't hit the server */
2492
+ $ this ->assertEquals ($ hello ['server ' ], $ this ->redis ->serverName ());
2493
+ $ this ->assertEquals ($ hello ['version ' ], $ this ->redis ->serverVersion ());
2494
+
2495
+ $ info = $ this ->redis ->info ();
2496
+ $ cmd2 = $ info ['total_commands_processed ' ];
2497
+
2498
+ $ this ->assertEquals (1 + $ cmd1 , $ cmd2 );
2499
+ }
2500
+
2501
+ public function testServerInfoOldRedis () {
2502
+ if ($ this ->minVersionCheck ('6.0.0 ' ))
2503
+ $ this ->markTestSkipped ();
2504
+
2505
+ $ this ->assertFalse ($ this ->redis ->serverName ());
2506
+ $ this ->assertFalse ($ this ->redis ->serverVersion ());
2507
+ }
2508
+
2460
2509
public function testInfoCommandStats () {
2461
2510
// INFO COMMANDSTATS is new in 2.6.0
2462
2511
if (version_compare ($ this ->version , '2.5.0 ' ) < 0 )
0 commit comments