@@ -1054,4 +1054,45 @@ public function test_wp_cache_get_multiple_np() {
10541054 $ actual = wp_cache_get_multiple ( [ 'foo ' ], $ group );
10551055 $ this ->assertSame ( $ expected , $ actual );
10561056 }
1057+
1058+ public function test_wp_cache_get_multiple_consistency () {
1059+ $ values = [
1060+ 'empty-string ' => '' ,
1061+ 'empty-array ' => [],
1062+ 'zero ' => 0 ,
1063+ 'false ' => false ,
1064+ 'null ' => null ,
1065+ ];
1066+
1067+ foreach ( $ values as $ key => $ value ) {
1068+ $ result = wp_cache_set ( $ key , $ value , 'group ' );
1069+ self ::assertTrue ( $ result );
1070+ }
1071+
1072+ $ actual = wp_cache_get_multiple ( array_keys ( $ values ), 'group ' , true );
1073+ self ::assertSame ( $ values , $ actual );
1074+ }
1075+
1076+ /**
1077+ * @dataProvider data_wp_cache_get_consistency
1078+ */
1079+ public function test_wp_cache_get_consistency ( $ value ) {
1080+ $ result = wp_cache_set ( 'key ' , $ value , 'group ' );
1081+ self ::assertTrue ( $ result );
1082+
1083+ $ found = false ;
1084+ $ actual = wp_cache_get ( 'key ' , 'group ' , true , $ found );
1085+ self ::assertTrue ( $ found );
1086+ self ::assertSame ( $ value , $ actual );
1087+ }
1088+
1089+ public function data_wp_cache_get_consistency () {
1090+ return [
1091+ 'empty string ' => [ '' ],
1092+ 'empty array ' => [ [] ],
1093+ 'zero ' => [ 0 ],
1094+ 'false ' => [ false ],
1095+ 'null ' => [ null ],
1096+ ];
1097+ }
10571098}
0 commit comments