@@ -2566,7 +2566,7 @@ public function testLongitude()
2566
2566
}
2567
2567
2568
2568
/**
2569
- * Test is_integer
2569
+ * Test isInteger
2570
2570
*
2571
2571
* @return void
2572
2572
*/
@@ -2584,4 +2584,86 @@ public function testIsInteger()
2584
2584
$ this ->assertFalse (Validation::isInteger (new \StdClass ));
2585
2585
$ this ->assertFalse (Validation::isInteger ('2 bears ' ));
2586
2586
}
2587
+
2588
+ /**
2589
+ * Test ascii
2590
+ *
2591
+ * @return void
2592
+ */
2593
+ public function testAscii ()
2594
+ {
2595
+ $ this ->assertTrue (Validation::ascii ('1 big blue bus. ' ));
2596
+ $ this ->assertTrue (Validation::ascii (',.<>[]{;/?\)() ' ));
2597
+
2598
+ $ this ->assertFalse (Validation::ascii ([]));
2599
+ $ this ->assertFalse (Validation::ascii (1001 ));
2600
+ $ this ->assertFalse (Validation::ascii (3.14 ));
2601
+ $ this ->assertFalse (Validation::ascii (new \StdClass ));
2602
+
2603
+ // Latin-1 supplement
2604
+ $ this ->assertFalse (Validation::ascii ('some ' . "\xc2\x82" . 'value ' ));
2605
+ $ this ->assertFalse (Validation::ascii ('some ' . "\xc3\xbf" . 'value ' ));
2606
+
2607
+ // End of BMP
2608
+ $ this ->assertFalse (Validation::ascii ('some ' . "\xef\xbf\xbd" . 'value ' ));
2609
+
2610
+ // Start of supplementary multilingual plane
2611
+ $ this ->assertFalse (Validation::ascii ('some ' . "\xf0\x90\x80\x80" . 'value ' ));
2612
+ }
2613
+
2614
+ /**
2615
+ * Test utf8 basic
2616
+ *
2617
+ * @return void
2618
+ */
2619
+ public function testUtf8Basic ()
2620
+ {
2621
+ $ this ->assertFalse (Validation::utf8 ([]));
2622
+ $ this ->assertFalse (Validation::utf8 (1001 ));
2623
+ $ this ->assertFalse (Validation::utf8 (3.14 ));
2624
+ $ this ->assertFalse (Validation::utf8 (new \StdClass ));
2625
+ $ this ->assertTrue (Validation::utf8 ('1 big blue bus. ' ));
2626
+ $ this ->assertTrue (Validation::utf8 (',.<>[]{;/?\)() ' ));
2627
+
2628
+ // Latin-1 supplement
2629
+ $ this ->assertTrue (Validation::utf8 ('some ' . "\xc2\x82" . 'value ' ));
2630
+ $ this ->assertTrue (Validation::utf8 ('some ' . "\xc3\xbf" . 'value ' ));
2631
+
2632
+ // End of BMP
2633
+ $ this ->assertTrue (Validation::utf8 ('some ' . "\xef\xbf\xbd" . 'value ' ));
2634
+
2635
+ // Start of supplementary multilingual plane
2636
+ $ this ->assertFalse (Validation::utf8 ('some ' . "\xf0\x90\x80\x80" . 'value ' ));
2637
+
2638
+ // Grinning face
2639
+ $ this ->assertFalse (Validation::utf8 ('some ' . "\xf0\x9f\x98\x80" . 'value ' ));
2640
+ }
2641
+
2642
+ /**
2643
+ * Test utf8 extended
2644
+ *
2645
+ * @return void
2646
+ */
2647
+ public function testUtf8Extended ()
2648
+ {
2649
+ $ this ->assertFalse (Validation::utf8 ([], ['extended ' => true ]));
2650
+ $ this ->assertFalse (Validation::utf8 (1001 , ['extended ' => true ]));
2651
+ $ this ->assertFalse (Validation::utf8 (3.14 , ['extended ' => true ]));
2652
+ $ this ->assertFalse (Validation::utf8 (new \StdClass , ['extended ' => true ]));
2653
+ $ this ->assertTrue (Validation::utf8 ('1 big blue bus. ' , ['extended ' => true ]));
2654
+ $ this ->assertTrue (Validation::utf8 (',.<>[]{;/?\)() ' , ['extended ' => true ]));
2655
+
2656
+ // Latin-1 supplement
2657
+ $ this ->assertTrue (Validation::utf8 ('some ' . "\xc2\x82" . 'value ' , ['extended ' => true ]));
2658
+ $ this ->assertTrue (Validation::utf8 ('some ' . "\xc3\xbf" . 'value ' , ['extended ' => true ]));
2659
+
2660
+ // End of BMP
2661
+ $ this ->assertTrue (Validation::utf8 ('some ' . "\xef\xbf\xbd" . 'value ' , ['extended ' => true ]));
2662
+
2663
+ // Start of supplementary multilingual plane
2664
+ $ this ->assertTrue (Validation::utf8 ('some ' . "\xf0\x90\x80\x80" . 'value ' , ['extended ' => true ]));
2665
+
2666
+ // Grinning face
2667
+ $ this ->assertTrue (Validation::utf8 ('some ' . "\xf0\x9f\x98\x80" . 'value ' , ['extended ' => true ]));
2668
+ }
2587
2669
}
0 commit comments