@@ -276,53 +276,15 @@ public function testBothifyCombinesNumerifyAndLexify()
276276 $ this ->assertRegExp ('/foo[a-z]Ba\dr/ ' , BaseProvider::bothify ('foo?Ba#r ' ));
277277 }
278278
279- public function allUtfCharsDataProvider ()
279+ public function testBothifyAsterisk ()
280280 {
281- // create test data
282- /** @link http://stackoverflow.com/questions/2748956/how-would-you-create-a-string-of-all-utf-8-characters */
283- function unichr ($ i )
284- {
285- return iconv ('UCS-4LE ' , 'UTF-8 ' , pack ('V ' , $ i ));
286- }
287- $ codeunits = array ();
288- for ($ i = 0 ; $ i <0xD800 ; $ i ++) {
289- $ codeunits [] = unichr ($ i );
290- }
291- for ($ i = 0xE000 ; $ i <0xFFFF ; $ i ++) {
292- $ codeunits [] = unichr ($ i );
293- }
294- $ data = implode ($ codeunits );
295- // end of test data
296-
297- return array (
298- array ('# ' , $ data ),
299- array ('? ' , $ data ),
300- array ('* ' , $ data ),
301- );
302- }
303-
304- /**
305- * @dataProvider allUtfCharsDataProvider
306- */
307- public function testStrposOnUtf ($ char , $ data )
308- {
309- $ pos = 0 ;
310- $ mbpos = 0 ;
311- $ count = 0 ;
312- $ mbcount = 0 ;
313- while (($ mbpos = mb_strpos ($ data , $ char , $ mbpos + 1 , 'UTF-8 ' )) !== false ) {
314- $ mbcount ++;
315- }
316- while (($ pos = strpos ($ data , $ char , $ pos + 1 )) !== false ) {
317- $ count ++;
318- }
319- $ this ->assertEquals (1 , $ mbcount );
320- $ this ->assertEquals (1 , $ count );
281+ $ this ->assertRegExp ('/foo([a-z]|\d)Ba([a-z]|\d)r/ ' , BaseProvider::bothify ('foo*Ba*r ' ));
321282 }
322283
323- public function testBothifyAsterisk ()
284+ public function testBothifyUtf ()
324285 {
325- $ this ->assertRegExp ('/foo([a-z]|\d)Ba([a-z]|\d)r/ ' , BaseProvider::bothify ('foo*Ba*r ' ));
286+ $ utf = 'œ∑´®†¥¨ˆøπ“‘和製╯°□°╯︵ ┻━┻🐵 🙈 ﺚﻣ ﻦﻔﺳ ﺲﻘﻄﺗ ﻮﺑﺎﻠﺘﺣﺪﻳﺩ،, ﺝﺰﻳﺮﺘﻳ ﺏﺎﺴﺘﺧﺩﺎﻣ ﺄﻧ ﺪﻧﻭ. ﺇﺫ ﻪﻧﺍ؟ ﺎﻠﺴﺗﺍﺭ ﻮﺘ ' ;
287+ $ this ->assertRegExp ('/ ' .$ utf .'foo\dB[a-z]a([a-z]|\d)r/u ' , BaseProvider::bothify ($ utf .'foo#B?a*r ' ));
326288 }
327289
328290 public function testAsciifyReturnsSameStringWhenItContainsNoStarSign ()
0 commit comments