@@ -122,28 +122,37 @@ public function test_locale_floats() {
122122
123123 /**
124124 * @ticket 10041
125+ * @dataProvider data_esc_like
125126 */
126- public function test_esc_like () {
127+ public function test_esc_like ( $ input , $ expected ) {
127128 global $ wpdb ;
128129
129- $ inputs = array (
130- 'howdy% ' , // Single percent.
131- 'howdy_ ' , // Single underscore.
132- 'howdy \\' , // Single slash.
133- 'howdy \\howdy%howdy_ ' , // The works.
134- 'howdy \'"[[]*#[^howdy]!+)(*&$#@!~|}{=--`/.,<>? ' , // Plain text.
135- );
136- $ expected = array (
137- 'howdy \\% ' ,
138- 'howdy \\_ ' ,
139- 'howdy \\\\' ,
140- 'howdy \\\\howdy \\%howdy \\_ ' ,
141- 'howdy \'"[[]*#[^howdy]!+)(*&$#@!~|}{=--`/.,<>? ' ,
142- );
130+ $ this ->assertSame ( $ expected , $ wpdb ->esc_like ( $ input ) );
131+ }
143132
144- foreach ( $ inputs as $ key => $ input ) {
145- $ this ->assertSame ( $ expected [ $ key ], $ wpdb ->esc_like ( $ input ) );
146- }
133+ public function data_esc_like () {
134+ return array (
135+ 'single percent ' => array (
136+ 'howdy% ' ,
137+ 'howdy \\% ' ,
138+ ),
139+ 'single underscore ' => array (
140+ 'howdy_ ' ,
141+ 'howdy \\_ ' ,
142+ ),
143+ 'single slash ' => array (
144+ 'howdy \\' ,
145+ 'howdy \\\\' ,
146+ ),
147+ 'the works ' => array (
148+ 'howdy \\howdy%howdy_ ' ,
149+ 'howdy \\\\howdy \\%howdy \\_ ' ,
150+ ),
151+ 'plain text ' => array (
152+ 'howdy \'"[[]*#[^howdy]!+)(*&$#@!~|}{=--`/.,<>? ' ,
153+ 'howdy \'"[[]*#[^howdy]!+)(*&$#@!~|}{=--`/.,<>? ' ,
154+ ),
155+ );
147156 }
148157
149158 /**
0 commit comments