@@ -5803,15 +5803,63 @@ public function testPackHelpers() {
58035803 public function testGetWithMeta () {
58045804 $ this ->redis ->del ('key ' );
58055805 $ this ->assertFalse ($ this ->redis ->get ('key ' ));
5806- $ this ->assertEquals ([false , ['length ' => -1 ]], $ this ->redis ->getWithMeta ('key ' ));
58075806
5808- $ this ->assertEquals ([false , [false , ['length ' => -1 ]]], $ this ->redis ->pipeline ()->get ('key ' )->getWithMeta ('key ' )->exec ());
5809- $ this ->assertEquals ([true , ['value ' , ['length ' => strlen ('value ' )]]], $ this ->redis ->multi ()->set ('key ' , 'value ' )->getWithMeta ('key ' )->exec ());
5807+ $ result = $ this ->redis ->getWithMeta ('key ' );
5808+ $ this ->assertIsArray ($ result , 2 );
5809+ $ this ->assertArrayKeyEquals ($ result , 0 , false );
5810+ $ this ->assertArrayKey ($ result , 1 , function ($ metadata ) {
5811+ $ this ->assertIsArray ($ metadata );
5812+ $ this ->assertArrayKeyEquals ($ metadata , 'length ' , -1 );
5813+ return true ;
5814+ });
5815+
5816+ $ batch = $ this ->redis ->pipeline ()
5817+ ->get ('key ' )
5818+ ->getWithMeta ('key ' )
5819+ ->exec ();
5820+ $ this ->assertIsArray ($ batch , 2 );
5821+ $ this ->assertArrayKeyEquals ($ batch , 0 , false );
5822+ $ this ->assertArrayKey ($ batch , 1 , function ($ result ) {
5823+ $ this ->assertIsArray ($ result , 2 );
5824+ $ this ->assertArrayKeyEquals ($ result , 0 , false );
5825+ $ this ->assertArrayKey ($ result , 1 , function ($ metadata ) {
5826+ $ this ->assertIsArray ($ metadata );
5827+ $ this ->assertArrayKeyEquals ($ metadata , 'length ' , -1 );
5828+ return true ;
5829+ });
5830+ return true ;
5831+ });
5832+
5833+ $ batch = $ this ->redis ->multi ()
5834+ ->set ('key ' , 'value ' )
5835+ ->getWithMeta ('key ' )
5836+ ->exec ();
5837+ $ this ->assertIsArray ($ batch , 2 );
5838+ $ this ->assertArrayKeyEquals ($ batch , 0 , true );
5839+ $ this ->assertArrayKey ($ batch , 1 , function ($ result ) {
5840+ $ this ->assertIsArray ($ result , 2 );
5841+ $ this ->assertArrayKeyEquals ($ result , 0 , 'value ' );
5842+ $ this ->assertArrayKey ($ result , 1 , function ($ metadata ) {
5843+ $ this ->assertIsArray ($ metadata );
5844+ $ this ->assertArrayKeyEquals ($ metadata , 'length ' , strlen ('value ' ));
5845+ return true ;
5846+ });
5847+ return true ;
5848+ });
58105849
58115850 $ serializer = $ this ->redis ->getOption (Redis::OPT_SERIALIZER );
58125851 $ this ->redis ->setOption (Redis::OPT_SERIALIZER , Redis::SERIALIZER_PHP );
58135852 $ this ->assertTrue ($ this ->redis ->set ('key ' , false ));
5814- $ this ->assertEquals ([false , ['length ' => strlen (serialize (false ))]], $ this ->redis ->getWithMeta ('key ' ));
5853+
5854+ $ result = $ this ->redis ->getWithMeta ('key ' );
5855+ $ this ->assertIsArray ($ result , 2 );
5856+ $ this ->assertArrayKeyEquals ($ result , 0 , false );
5857+ $ this ->assertArrayKey ($ result , 1 , function ($ metadata ) {
5858+ $ this ->assertIsArray ($ metadata );
5859+ $ this ->assertArrayKeyEquals ($ metadata , 'length ' , strlen (serialize (false )));
5860+ return true ;
5861+ });
5862+
58155863 $ this ->assertFalse ($ this ->redis ->get ('key ' ));
58165864 $ this ->redis ->setOption (Redis::OPT_SERIALIZER , $ serializer );
58175865 }
0 commit comments