1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kint\Test; |
4
|
|
|
|
5
|
|
|
use Exception; |
6
|
|
|
use Kint\Kint; |
7
|
|
|
use Kint\Object\BlobObject; |
8
|
|
|
use Kint\Parser\Parser; |
9
|
|
|
use Kint\Parser\ProxyPlugin; |
10
|
|
|
use Kint\Renderer\TextRenderer; |
11
|
|
|
use PHPUnit_Framework_AssertionFailedError; |
12
|
|
|
use PHPUnit_Framework_Exception; |
13
|
|
|
|
14
|
|
|
class IntegrationTest extends KintTestCase |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @covers \d |
18
|
|
|
* @covers \s |
19
|
|
|
* @covers \Kint\Kint::dump |
20
|
|
|
*/ |
21
|
|
|
public function testBasicDumps() |
22
|
|
|
{ |
23
|
|
|
$testdata = array( |
24
|
|
|
1234, |
25
|
|
|
(object) array('abc' => 'def'), |
26
|
|
|
1234.5678, |
27
|
|
|
'Good news everyone! I\'ve got some bad news!', |
28
|
|
|
null, |
29
|
|
|
); |
30
|
|
|
|
31
|
|
|
$testdata[] = &$testdata; |
32
|
|
|
|
33
|
|
|
$array_structure = array( |
|
|
|
|
34
|
|
|
'0', 'integer', '1234', |
35
|
|
|
'1', 'stdClass', '1', |
36
|
|
|
'public', 'abc', 'string', '3', 'def', |
37
|
|
|
'2', 'double', '1234.5678', |
38
|
|
|
'3', 'string', '43', 'Good news everyone! I\'ve got some bad news!', |
39
|
|
|
'4', 'null', |
40
|
|
|
); |
41
|
|
|
|
42
|
|
|
Kint::$return = true; |
43
|
|
|
Kint::$cli_detection = false; |
44
|
|
|
Kint::$display_called_from = false; |
45
|
|
|
|
46
|
|
|
Kint::$enabled_mode = Kint::MODE_RICH; |
47
|
|
|
$richbase = d($testdata); |
48
|
|
|
|
49
|
|
|
$this->assertLike( |
50
|
|
|
array_merge( |
51
|
|
|
$array_structure, |
|
|
|
|
52
|
|
|
array('&array', '6'), |
53
|
|
|
$array_structure, |
|
|
|
|
54
|
|
|
array('&array', 'Recursion') |
55
|
|
|
), |
56
|
|
|
$richbase |
57
|
|
|
); |
58
|
|
|
|
59
|
|
|
Kint::$enabled_mode = true; |
60
|
|
|
$this->assertSame($richbase, d($testdata)); |
61
|
|
|
$this->assertSame($richbase, Kint::dump($testdata)); |
62
|
|
|
|
63
|
|
|
Kint::$enabled_mode = Kint::MODE_PLAIN; |
64
|
|
|
$plainbase = d($testdata); |
65
|
|
|
|
66
|
|
|
$this->assertLike( |
67
|
|
|
array_merge( |
68
|
|
|
$array_structure, |
|
|
|
|
69
|
|
|
array('&array', '6'), |
70
|
|
|
$array_structure, |
|
|
|
|
71
|
|
|
array('&array', 'RECURSION') |
72
|
|
|
), |
73
|
|
|
$plainbase |
74
|
|
|
); |
75
|
|
|
|
76
|
|
|
$this->assertSame($plainbase, Kint::dump($testdata)); |
77
|
|
|
|
78
|
|
|
Kint::$enabled_mode = true; |
79
|
|
|
$this->assertSame($plainbase, s($testdata)); |
80
|
|
|
|
81
|
|
|
Kint::$enabled_mode = Kint::MODE_CLI; |
82
|
|
|
$clibase = d($testdata); |
83
|
|
|
|
84
|
|
|
$this->assertLike( |
85
|
|
|
array_merge( |
86
|
|
|
$array_structure, |
|
|
|
|
87
|
|
|
array('&array', '6'), |
88
|
|
|
$array_structure, |
|
|
|
|
89
|
|
|
array('&array', 'RECURSION') |
90
|
|
|
), |
91
|
|
|
$clibase |
92
|
|
|
); |
93
|
|
|
|
94
|
|
|
$this->assertSame($clibase, Kint::dump($testdata)); |
95
|
|
|
|
96
|
|
|
Kint::$enabled_mode = true; |
97
|
|
|
Kint::$cli_detection = true; |
98
|
|
|
$this->assertSame($clibase, d($testdata)); |
99
|
|
|
$this->assertSame($clibase, s($testdata)); |
100
|
|
|
Kint::$cli_detection = false; |
101
|
|
|
|
102
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
103
|
|
|
$textbase = d($testdata); |
104
|
|
|
|
105
|
|
|
$this->assertLike( |
106
|
|
|
array_merge( |
107
|
|
|
$array_structure, |
|
|
|
|
108
|
|
|
array('&array', '6'), |
109
|
|
|
$array_structure, |
|
|
|
|
110
|
|
|
array('&array', 'RECURSION') |
111
|
|
|
), |
112
|
|
|
$textbase |
113
|
|
|
); |
114
|
|
|
|
115
|
|
|
$this->assertSame($textbase, Kint::dump($testdata)); |
116
|
|
|
|
117
|
|
|
Kint::$return = false; |
118
|
|
|
Kint::$enabled_mode = true; |
119
|
|
|
ob_start(); |
120
|
|
|
~d($testdata); |
121
|
|
|
$this->assertSame($textbase, ob_get_clean()); |
122
|
|
|
|
123
|
|
|
Kint::$enabled_mode = false; |
124
|
|
|
$this->assertSame(0, d($testdata)); |
125
|
|
|
$this->assertSame(0, s($testdata)); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @covers \Kint\Kint::dump |
130
|
|
|
*/ |
131
|
|
|
public function testDumpBadMode() |
132
|
|
|
{ |
133
|
|
|
Kint::$return = true; |
134
|
|
|
Kint::$cli_detection = false; |
135
|
|
|
Kint::$display_called_from = false; |
136
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
137
|
|
|
TextRenderer::$decorations = false; |
138
|
|
|
|
139
|
|
|
$d1 = Kint::dump(1234); |
|
|
|
|
140
|
|
|
|
141
|
|
|
Kint::$enabled_mode = 'This is not a real mode'; |
142
|
|
|
$d2 = Kint::dump(1234); |
|
|
|
|
143
|
|
|
|
144
|
|
|
$this->assertEquals($d1, $d2); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @covers \Kint\Kint::dump |
149
|
|
|
* @covers \Kint\Kint::trace |
150
|
|
|
*/ |
151
|
|
|
public function testFlushModifier() |
152
|
|
|
{ |
153
|
|
|
Kint::$return = true; |
154
|
|
|
Kint::$cli_detection = false; |
155
|
|
|
Kint::$display_called_from = false; |
156
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
157
|
|
|
TextRenderer::$decorations = false; |
158
|
|
|
|
159
|
|
|
$base_level = ob_get_level(); |
|
|
|
|
160
|
|
|
ob_start(); |
161
|
|
|
$this->assertSame($base_level + 1, ob_get_level()); |
|
|
|
|
162
|
|
|
Kint::dump(1234); |
163
|
|
|
$this->assertSame($base_level + 1, ob_get_level()); |
|
|
|
|
164
|
|
|
// Please leave the ! modifier in place, to prevent errors using unary - on a returned string |
165
|
|
|
-!Kint::dump(1234); |
166
|
|
|
$this->assertSame(0, ob_get_level()); |
167
|
|
|
|
168
|
|
|
ob_start(); |
169
|
|
|
$this->assertSame(1, ob_get_level()); |
170
|
|
|
Kint::trace(); |
171
|
|
|
$this->assertSame(1, ob_get_level()); |
172
|
|
|
// Please leave the ! modifier in place, to prevent errors using unary - on a returned string |
173
|
|
|
-!Kint::trace(); |
174
|
|
|
$this->assertSame(0, ob_get_level()); |
175
|
|
|
|
176
|
|
|
while ($base_level > ob_get_level()) { |
|
|
|
|
177
|
|
|
ob_start(); |
178
|
|
|
} |
179
|
|
|
$this->assertSame($base_level, ob_get_level()); |
|
|
|
|
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @covers \Kint\Kint::dump |
184
|
|
|
*/ |
185
|
|
|
public function testExpandModifier() |
186
|
|
|
{ |
187
|
|
|
Kint::$return = true; |
188
|
|
|
Kint::$cli_detection = false; |
189
|
|
|
Kint::$display_called_from = false; |
190
|
|
|
Kint::$enabled_mode = Kint::MODE_RICH; |
191
|
|
|
|
192
|
|
|
$value = array('a' => array(1, 2, 3), 'b' => 'c'); |
193
|
|
|
|
194
|
|
|
$d1 = Kint::dump($value); |
|
|
|
|
195
|
|
|
|
196
|
|
|
Kint::$return = false; |
197
|
|
|
ob_start(); |
198
|
|
|
!Kint::dump($value); |
199
|
|
|
$d2 = ob_get_clean(); |
|
|
|
|
200
|
|
|
|
201
|
|
|
$this->assertNotEquals($d1, $d2); |
202
|
|
|
|
203
|
|
|
$d3 = str_replace(' kint-show', '', $d2); |
|
|
|
|
204
|
|
|
$this->assertEquals($d1, $d3); |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* @covers \Kint\Kint::dump |
209
|
|
|
* @covers \Kint\Kint::trace |
210
|
|
|
*/ |
211
|
|
|
public function testTextModifier() |
212
|
|
|
{ |
213
|
|
|
Kint::$cli_detection = false; |
214
|
|
|
Kint::$display_called_from = false; |
215
|
|
|
TextRenderer::$decorations = false; |
216
|
|
|
|
217
|
|
|
$value = array('a' => array(1, 2, 3), 'b' => 'c'); |
218
|
|
|
|
219
|
|
|
Kint::$return = false; |
220
|
|
|
Kint::$enabled_mode = Kint::MODE_RICH; |
221
|
|
|
|
222
|
|
|
ob_start(); |
223
|
|
|
~Kint::dump($value); |
224
|
|
|
$d1 = ob_get_clean(); |
|
|
|
|
225
|
|
|
|
226
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
227
|
|
|
Kint::$return = true; |
228
|
|
|
$d2 = Kint::dump($value); |
|
|
|
|
229
|
|
|
|
230
|
|
|
$this->assertSame($d1, $d2); |
231
|
|
|
|
232
|
|
|
Kint::$enabled_mode = Kint::MODE_RICH; |
233
|
|
|
Kint::$return = false; |
234
|
|
|
|
235
|
|
|
ob_start(); |
236
|
|
|
~Kint::trace(); |
237
|
|
|
$d1 = ob_get_clean(); |
238
|
|
|
$bt = debug_backtrace(true); |
|
|
|
|
239
|
|
|
array_unshift($bt, array( |
240
|
|
|
'line' => __LINE__ - 4, |
241
|
|
|
'class' => 'Kint\\Kint', |
242
|
|
|
'function' => 'trace', |
243
|
|
|
'file' => __FILE__, |
244
|
|
|
)); |
245
|
|
|
|
246
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
247
|
|
|
Kint::$return = true; |
248
|
|
|
|
249
|
|
|
$d2 = preg_replace('/^\$bt\b/', 'Kint\\Kint::trace()', Kint::dump($bt)); |
250
|
|
|
|
251
|
|
|
$this->assertSame($d1, $d2); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* @covers \Kint\Kint::dump |
256
|
|
|
*/ |
257
|
|
|
public function testDeepModifier() |
258
|
|
|
{ |
259
|
|
|
Kint::$return = false; |
260
|
|
|
Kint::$cli_detection = false; |
261
|
|
|
Kint::$display_called_from = false; |
262
|
|
|
Kint::$max_depth = 1; |
263
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
264
|
|
|
|
265
|
|
|
$value = array('a' => array(1, 2, 3), 'b' => 'c'); |
266
|
|
|
|
267
|
|
|
ob_start(); |
268
|
|
|
+Kint::dump($value); |
269
|
|
|
$d1 = ob_get_clean(); |
|
|
|
|
270
|
|
|
|
271
|
|
|
Kint::$return = true; |
272
|
|
|
$d2 = Kint::dump($value); |
|
|
|
|
273
|
|
|
|
274
|
|
|
$this->assertNotEquals($d1, $d2); |
275
|
|
|
|
276
|
|
|
Kint::$max_depth = 0; |
277
|
|
|
$d2 = Kint::dump($value); |
278
|
|
|
|
279
|
|
|
$this->assertEquals($d1, $d2); |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* @covers \Kint\Kint::dump |
284
|
|
|
*/ |
285
|
|
|
public function testReturnModifier() |
286
|
|
|
{ |
287
|
|
|
Kint::$return = false; |
288
|
|
|
Kint::$cli_detection = false; |
289
|
|
|
Kint::$display_called_from = false; |
290
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
291
|
|
|
|
292
|
|
|
$value = array('a' => array(1, 2, 3), 'b' => 'c'); |
293
|
|
|
|
294
|
|
|
ob_start(); |
295
|
|
|
$d1 = @Kint::dump($value); |
|
|
|
|
296
|
|
|
$out = ob_get_clean(); |
297
|
|
|
|
298
|
|
|
Kint::$return = true; |
299
|
|
|
$d2 = Kint::dump($value); |
|
|
|
|
300
|
|
|
|
301
|
|
|
$this->assertEquals($d1, $d2); |
302
|
|
|
$this->assertEmpty($out); |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* @covers \Kint\Kint::dump |
307
|
|
|
* @covers \Kint\Kint::trace |
308
|
|
|
*/ |
309
|
|
|
public function testTrace() |
310
|
|
|
{ |
311
|
|
|
Kint::$return = true; |
312
|
|
|
Kint::$cli_detection = false; |
313
|
|
|
Kint::$display_called_from = false; |
314
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
315
|
|
|
Kint::$max_depth = 3; |
316
|
|
|
TextRenderer::$decorations = false; |
317
|
|
|
|
318
|
|
|
$bt = debug_backtrace(true); |
|
|
|
|
319
|
|
|
array_unshift($bt, array( |
320
|
|
|
'class' => 'Kint\\Kint', |
321
|
|
|
'file' => __FILE__, |
322
|
|
|
)); |
323
|
|
|
|
324
|
|
|
$d2 = Kint::dump(1); |
|
|
|
|
325
|
|
|
$bt[0]['line'] = __LINE__ - 1; |
326
|
|
|
$bt[0]['function'] = 'dump'; |
327
|
|
|
$d1 = preg_replace('/^\$bt\b/', 'Kint\\Kint::dump(1)', Kint::dump($bt)); |
|
|
|
|
328
|
|
|
$this->assertSame($d1, $d2); |
329
|
|
|
|
330
|
|
|
$d2 = Kint::trace(); |
331
|
|
|
$bt[0]['line'] = __LINE__ - 1; |
332
|
|
|
$bt[0]['function'] = 'trace'; |
333
|
|
|
$d1 = preg_replace('/^\$bt\b/', 'Kint\\Kint::trace()', Kint::dump($bt)); |
334
|
|
|
$this->assertSame($d1, $d2); |
335
|
|
|
|
336
|
|
|
Kint::$return = false; |
337
|
|
|
|
338
|
|
|
ob_start(); |
339
|
|
|
Kint::trace(); |
340
|
|
|
$d2 = ob_get_clean(); |
341
|
|
|
$bt[0]['line'] = __LINE__ - 2; |
342
|
|
|
$bt[0]['function'] = 'trace'; |
343
|
|
|
Kint::$return = true; |
344
|
|
|
$d1 = preg_replace('/^\$bt\b/', 'Kint\\Kint::trace()', Kint::dump($bt)); |
345
|
|
|
$this->assertSame($d1, $d2); |
346
|
|
|
|
347
|
|
|
Kint::$enabled_mode = false; |
348
|
|
|
|
349
|
|
|
$this->assertSame(0, Kint::trace()); |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* @covers \Kint\Kint::dump |
354
|
|
|
* @covers \Kint\Kint::trace |
355
|
|
|
*/ |
356
|
|
|
public function testToplevelTrace() |
357
|
|
|
{ |
358
|
|
|
Kint::$return = true; |
359
|
|
|
Kint::$cli_detection = false; |
360
|
|
|
Kint::$display_called_from = false; |
361
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
362
|
|
|
TextRenderer::$decorations = false; |
363
|
|
|
|
364
|
|
|
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
|
|
|
|
365
|
|
|
$firstframe = end($bt); |
366
|
|
|
|
367
|
|
|
if (isset($firstframe['class'])) { |
368
|
|
|
Kint::$aliases[] = array($firstframe['class'], $firstframe['function']); |
369
|
|
|
} else { |
370
|
|
|
Kint::$aliases[] = $firstframe['function']; |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
$d1 = Kint::dump(1); |
|
|
|
|
374
|
|
|
$d2 = Kint::trace(); |
|
|
|
|
375
|
|
|
|
376
|
|
|
$d1 = explode("\n", $d1); |
377
|
|
|
array_shift($d1); |
378
|
|
|
$d1 = implode("\n", $d1); |
379
|
|
|
|
380
|
|
|
$d2 = explode("\n", $d2); |
381
|
|
|
array_shift($d2); |
382
|
|
|
$d2 = implode("\n", $d2); |
383
|
|
|
|
384
|
|
|
$this->assertEquals($d1, $d2); |
385
|
|
|
|
386
|
|
|
$this->assertLike( |
387
|
|
|
array( |
388
|
|
|
'Debug Backtrace (1):', |
389
|
|
|
Kint::shortenPath($firstframe['file']).':'.$firstframe['line'], |
390
|
|
|
), |
391
|
|
|
$d1 |
392
|
|
|
); |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* @covers \Kint\Kint::dump |
397
|
|
|
*/ |
398
|
|
|
public function testDumpNothing() |
399
|
|
|
{ |
400
|
|
|
Kint::$return = true; |
401
|
|
|
Kint::$cli_detection = false; |
402
|
|
|
Kint::$display_called_from = false; |
403
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
404
|
|
|
TextRenderer::$decorations = false; |
405
|
|
|
|
406
|
|
|
$d = Kint::dump(); |
|
|
|
|
407
|
|
|
$this->assertSame("No argument\n", $d); |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* @covers \Kint\Kint::dump |
412
|
|
|
*/ |
413
|
|
|
public function testNoParamNames() |
414
|
|
|
{ |
415
|
|
|
Kint::$return = true; |
416
|
|
|
Kint::$cli_detection = false; |
417
|
|
|
Kint::$display_called_from = false; |
418
|
|
|
Kint::$enabled_mode = Kint::MODE_RICH; |
419
|
|
|
TextRenderer::$decorations = false; |
420
|
|
|
|
421
|
|
|
$values = array(array(1), array(2), array(3)); |
422
|
|
|
|
423
|
|
|
$d = call_user_func_array('Kint::dump', $values); |
|
|
|
|
424
|
|
|
$this->assertLike( |
425
|
|
|
array( |
426
|
|
|
'$0[0]', |
427
|
|
|
'$1[0]', |
428
|
|
|
'$2[0]', |
429
|
|
|
), |
430
|
|
|
$d |
431
|
|
|
); |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
/** |
435
|
|
|
* @covers \Kint\Kint::dump |
436
|
|
|
*/ |
437
|
|
|
public function testPlugins() |
438
|
|
|
{ |
439
|
|
|
Kint::$return = true; |
440
|
|
|
Kint::$cli_detection = false; |
441
|
|
|
Kint::$display_called_from = false; |
442
|
|
|
Kint::$enabled_mode = Kint::MODE_TEXT; |
443
|
|
|
TextRenderer::$decorations = false; |
444
|
|
|
|
445
|
|
|
$p1_triggered = false; |
|
|
|
|
446
|
|
|
$p1 = new ProxyPlugin( |
|
|
|
|
447
|
|
|
array('resource'), |
448
|
|
|
Parser::TRIGGER_SUCCESS, |
449
|
|
|
function () use (&$p1_triggered) { |
450
|
|
|
$p1_triggered = true; |
|
|
|
|
451
|
|
|
} |
452
|
|
|
); |
453
|
|
|
|
454
|
|
|
$value = fopen(__FILE__, 'r'); |
455
|
|
|
|
456
|
|
|
try { |
457
|
|
|
Kint::$plugins = array(); |
458
|
|
|
$d1 = Kint::dump($value); |
|
|
|
|
459
|
|
|
|
460
|
|
|
Kint::$plugins = array( |
461
|
|
|
$p1, |
462
|
|
|
'Kint\\Parser\\StreamPlugin', |
463
|
|
|
); |
464
|
|
|
TextRenderer::$parser_plugin_whitelist = array('Kint\\Parser\\Plugin'); |
465
|
|
|
|
466
|
|
|
$this->assertFalse($p1_triggered); |
|
|
|
|
467
|
|
|
|
468
|
|
|
$d2 = Kint::dump($value); |
|
|
|
|
469
|
|
|
|
470
|
|
|
fclose($value); |
471
|
|
|
} catch (Exception $e) { |
472
|
|
|
fclose($value); |
473
|
|
|
|
474
|
|
|
throw $e; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
$this->assertTrue($p1_triggered); |
|
|
|
|
478
|
|
|
$this->assertLike( |
479
|
|
|
array( |
480
|
|
|
'$value', |
481
|
|
|
'stream resource', |
482
|
|
|
Kint::shortenPath(__FILE__), |
483
|
|
|
), |
484
|
|
|
$d2 |
485
|
|
|
); |
486
|
|
|
$this->assertNotSame($d1, $d2); |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* Test this test suite's restore after test. |
491
|
|
|
* |
492
|
|
|
* @covers \Kint\Test\KintTestCase::setUp |
493
|
|
|
* @covers \Kint\Test\KintTestCase::tearDown |
494
|
|
|
*/ |
495
|
|
|
public function testStore() |
496
|
|
|
{ |
497
|
|
|
Kint::$file_link_format = 'test_store'; |
498
|
|
|
$this->assertEquals('test_store', Kint::$file_link_format); |
499
|
|
|
BlobObject::$char_encodings[] = 'this_is_not_a_real_encoding'; |
500
|
|
|
$this->assertContains('this_is_not_a_real_encoding', BlobObject::$char_encodings); |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
/** |
504
|
|
|
* @covers \Kint\Test\KintTestCase::setUp |
505
|
|
|
* @covers \Kint\Test\KintTestCase::tearDown |
506
|
|
|
*/ |
507
|
|
|
public function testRestore() |
508
|
|
|
{ |
509
|
|
|
$this->assertNotEquals('test_store', Kint::$file_link_format); |
510
|
|
|
$this->assertNotContains('this_is_not_a_real_encoding', BlobObject::$char_encodings); |
511
|
|
|
} |
512
|
|
|
|
513
|
|
|
/** |
514
|
|
|
* @covers \Kint\Test\KintTestCase::assertLike |
515
|
|
|
*/ |
516
|
|
|
public function testLike() |
517
|
|
|
{ |
518
|
|
|
$this->assertLike(array('a', 'b', 'c'), 'foo a bar baz c buzz'); |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* @covers \Kint\Test\KintTestCase::assertLike |
523
|
|
|
*/ |
524
|
|
|
public function testNotLike() |
525
|
|
|
{ |
526
|
|
|
try { |
527
|
|
|
$this->assertLike(array('a', 'b', 'c', 'o'), 'foo a bar baz c buzz'); |
528
|
|
|
} catch (PHPUnit_Framework_AssertionFailedError $e) { |
529
|
|
|
return; |
530
|
|
|
} |
531
|
|
|
|
532
|
|
|
self::fail('Failed to mismatch'); |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
/** |
536
|
|
|
* @covers \Kint\Test\KintTestCase::assertLike |
537
|
|
|
*/ |
538
|
|
|
public function testLikeNonString() |
539
|
|
|
{ |
540
|
|
|
try { |
541
|
|
|
$this->assertLike(array('a', 'b', 'c'), array('a', 'b', 'c')); |
542
|
|
|
} catch (PHPUnit_Framework_Exception $e) { |
543
|
|
|
return; |
544
|
|
|
} |
545
|
|
|
|
546
|
|
|
self::fail('Failed to throw'); |
547
|
|
|
} |
548
|
|
|
} |
549
|
|
|
|
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.