1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
class SanityTest extends KintTestCase |
4
|
|
|
{ |
5
|
|
|
/** |
6
|
|
|
* Essentially a copy paste job of the basic.php test. |
7
|
|
|
* |
8
|
|
|
* It's more of an integration test than a unit test. |
9
|
|
|
*/ |
10
|
|
|
public function testSanity() |
11
|
|
|
{ |
12
|
|
|
$testdata = array( |
13
|
|
|
1234, |
14
|
|
|
(object) array('abc' => 'def'), |
15
|
|
|
1234.5678, |
16
|
|
|
'Good news everyone! I\'ve got some bad news!', |
17
|
|
|
null, |
18
|
|
|
); |
19
|
|
|
|
20
|
|
|
$testdata[] = &$testdata; |
21
|
|
|
|
22
|
|
|
$array_structure = array( |
23
|
|
|
'0', 'integer', '1234', |
24
|
|
|
'1', 'stdClass', '1', |
25
|
|
|
'public', 'abc', 'string', '3', 'def', |
26
|
|
|
'2', 'double', '1234.5678', |
27
|
|
|
'3', 'string', '43', 'Good news everyone! I\'ve got some bad news!', |
28
|
|
|
'4', 'null', |
29
|
|
|
); |
30
|
|
|
|
31
|
|
|
Kint::$return = true; |
32
|
|
|
Kint::$cli_detection = false; |
33
|
|
|
|
34
|
|
|
Kint::$enabled_mode = Kint::MODE_RICH; |
35
|
|
|
$this->assertLike(array_merge( |
36
|
|
|
$array_structure, |
37
|
|
|
array('&array', '6'), |
38
|
|
|
$array_structure, |
39
|
|
|
array('&array', 'Recursion') |
40
|
|
|
), |
41
|
|
|
d($testdata) |
42
|
|
|
); |
43
|
|
|
|
44
|
|
|
Kint::$enabled_mode = Kint::MODE_PLAIN; |
45
|
|
|
$this->assertLike(array_merge( |
46
|
|
|
$array_structure, |
47
|
|
|
array('&array', '6'), |
48
|
|
|
$array_structure, |
49
|
|
|
array('&array', 'RECURSION') |
50
|
|
|
), |
51
|
|
|
d($testdata) |
52
|
|
|
); |
53
|
|
|
|
54
|
|
|
Kint::$enabled_mode = Kint::MODE_CLI; |
55
|
|
|
$this->assertLike(array_merge( |
56
|
|
|
$array_structure, |
57
|
|
|
array('&array', '6'), |
58
|
|
|
$array_structure, |
59
|
|
|
array('&array', 'RECURSION') |
60
|
|
|
), |
61
|
|
|
d($testdata) |
62
|
|
|
); |
63
|
|
|
|
64
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
65
|
|
|
$this->assertLike(array_merge( |
66
|
|
|
$array_structure, |
67
|
|
|
array('&array', '6'), |
68
|
|
|
$array_structure, |
69
|
|
|
array('&array', 'RECURSION') |
70
|
|
|
), |
71
|
|
|
d($testdata) |
72
|
|
|
); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Test this test suite's restore after test. |
77
|
|
|
*/ |
78
|
|
|
public function testStore() |
79
|
|
|
{ |
80
|
|
|
Kint::$return = 'test_store'; |
|
|
|
|
81
|
|
|
$this->assertEquals('test_store', Kint::$return); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Test this test suite's restore after test. |
86
|
|
|
* |
87
|
|
|
* @depends testStore |
88
|
|
|
*/ |
89
|
|
|
public function testRestore() |
90
|
|
|
{ |
91
|
|
|
$this->assertNotEquals('test_store', Kint::$return); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.