@@ -1073,27 +1073,26 @@ public function test_wp_cache_get_multiple_consistency() {
10731073 self ::assertSame ( $ values , $ actual );
10741074 }
10751075
1076- public function test_wp_cache_get_consistency () {
1077- $ values = [
1078- 'empty-string ' => '' ,
1079- 'empty-array ' => [],
1080- 'zero ' => 0 ,
1081- 'false ' => false ,
1082- 'null ' => null ,
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 ],
10831096 ];
1084-
1085- foreach ( $ values as $ key => $ value ) {
1086- $ result = wp_cache_set ( $ key , $ value , 'group ' );
1087- self ::assertTrue ( $ result );
1088- }
1089-
1090- $ this ->object_cache ->cache = [];
1091-
1092- foreach ( $ values as $ key => $ expected ) {
1093- $ found = false ;
1094- $ actual = wp_cache_get ( $ key , 'group ' , true , $ found );
1095- self ::assertTrue ( $ found );
1096- self ::assertSame ( $ expected , $ actual );
1097- }
10981097 }
10991098}
0 commit comments