@@ -262,6 +262,9 @@ function test_29_DateTime()
262
262
263
263
// ------------------------- INTL tests -----------------------
264
264
265
+ /**
266
+ * @since 5.3.0
267
+ */
265
268
function test_30_Intl_Number_Format ()
266
269
{
267
270
global $ testsLoopLimits , $ totalOps , $ emptyResult ;
@@ -300,6 +303,9 @@ function test_30_Intl_Number_Format()
300
303
return format_result_test (get_microtime () - $ time_start , $ count , mymemory_usage ());
301
304
}
302
305
306
+ /**
307
+ * @since 5.3.0
308
+ */
303
309
function test_31_Intl_Message_Format ()
304
310
{
305
311
global $ testsLoopLimits , $ totalOps , $ emptyResult ;
@@ -325,3 +331,42 @@ function test_31_Intl_Message_Format()
325
331
$ totalOps += $ count ;
326
332
return format_result_test (get_microtime () - $ time_start , $ count , mymemory_usage ());
327
333
}
334
+
335
+ /**
336
+ * @since: 5.5.0
337
+ */
338
+ function test_32_Intl_Calendar ()
339
+ {
340
+ global $ testsLoopLimits , $ totalOps , $ emptyResult ;
341
+
342
+ if (!class_exists ('IntlCalendar ' , false )) {
343
+ return $ emptyResult ;
344
+ }
345
+ if (!class_exists ('IntlTimeZone ' , false )) {
346
+ return $ emptyResult ;
347
+ }
348
+
349
+ $ count = $ testsLoopLimits ['32_intl_calendar ' ];
350
+ $ time_start = get_microtime ();
351
+
352
+ $ cal = IntlCalendar::createInstance (IntlTimeZone::getGMT ());
353
+
354
+ $ a = 0 ;
355
+ for ($ i = 0 ; $ i < $ count ; $ i ++) {
356
+ $ num = $ i / 100. ;
357
+ $ cal ->clear ();
358
+ $ cal ->setTime ($ num );
359
+
360
+ if ($ cal ->inDaylightTime ()) $ a ++;
361
+ if ($ cal ->isWeekend ()) $ a --;
362
+ if ($ cal ->getMinimalDaysInFirstWeek ()) $ a ++;
363
+
364
+ $ cal ->add (IntlCalendar::FIELD_MONTH , 1 );
365
+ $ cal ->add (IntlCalendar::FIELD_DAY_OF_MONTH , 1 );
366
+ if ($ cal ->inDaylightTime ()) $ a --;
367
+ if ($ cal ->isWeekend ()) $ a ++;
368
+ if ($ cal ->getMinimalDaysInFirstWeek ()) $ a --;
369
+ }
370
+ $ totalOps += $ count ;
371
+ return format_result_test (get_microtime () - $ time_start , $ count , mymemory_usage ());
372
+ }
0 commit comments