File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
tests/phpunit/tests/formatting Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ class Tests_Formatting_ConvertInvalidEntities extends WP_UnitTestCase {
7
7
8
8
/**
9
9
* @dataProvider data_convert_invalid_entities_strings
10
+ * @dataProvider data_convert_invalid_entities_non_string
10
11
*
11
12
* @covers ::convert_invalid_entities
12
13
*
@@ -52,6 +53,39 @@ public function data_convert_invalid_entities_strings() {
52
53
);
53
54
}
54
55
56
+ /**
57
+ * Data provider to safeguard consistent handling on unexpected data types.
58
+ *
59
+ * @return array
60
+ */
61
+ public function data_convert_invalid_entities_non_string () {
62
+ $ std_class = new stdClass ();
63
+ $ std_class ->property = 'value ' ;
64
+
65
+ return array (
66
+ 'null ' => array (
67
+ 'input ' => null ,
68
+ 'output ' => null ,
69
+ ),
70
+ 'false ' => array (
71
+ 'input ' => false ,
72
+ 'output ' => false ,
73
+ ),
74
+ 'true ' => array (
75
+ 'input ' => true ,
76
+ 'output ' => true ,
77
+ ),
78
+ 'int ' => array (
79
+ 'input ' => 7486 ,
80
+ 'output ' => 7486 ,
81
+ ),
82
+ 'float ' => array (
83
+ 'input ' => 25.689 ,
84
+ 'output ' => 25.689 ,
85
+ ),
86
+ );
87
+ }
88
+
55
89
function test_escapes_lone_ampersands () {
56
90
$ this ->assertSame ( 'at&t ' , convert_chars ( 'at&t ' ) );
57
91
}
You can’t perform that action at this time.
0 commit comments