Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Test miscellaneous methods.
*
* @package WP_Revisions_Control
*/
/**
* Class TestMisc.
*/
class TestMisc extends WP_UnitTestCase {
/**
* Test settings sanitization.
*/
public function test_settings_sanitization() {
$input = array(
'minus_ten' => -10,
'minus_one' => -1,
'zero' => 0,
'one' => 1,
'thirty' => 30,
'empty_string' => '',
'bool_false' => false,
'bool_true' => true,
'null' => null,
);
$expected = array(
'minus_ten' => -1,
'minus_one' => -1,
'zero' => 0,
'one' => 1,
'thirty' => 30,
'empty_string' => -1,
'bool_false' => -1,
'bool_true' => 1,
'null' => -1,
);
$sanitized = WP_Revisions_Control::get_instance()->sanitize_options( $input );
$this->assertEquals(
$expected,
$sanitized,
'Failed to assert that options were sanitized correctly.'
);
}
}