Completed
Push — php70 ( 65aa73...103023 )
by Wim
03:55 queued 01:01
created

DeprecatedFunctionsSniffTest::testLdapSort()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 1
b 0
f 1
1
<?php
2
/**
3
 * Deprecated functions sniff test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Deprecated functions sniff tests
11
 *
12
 * @uses BaseSniffTest
13
 * @package PHPCompatibility
14
 * @author Jansen Price <[email protected]>
15
 */
16
class DeprecatedFunctionsSniffTest extends BaseSniffTest
17
{
18
    /**
19
     * Test call user method
20
     *
21
     * @return void
22
     */
23 View Code Duplication
    public function testCallUserMethod()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
    {
25
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
26
        $this->assertWarning($file, 3, 'The use of function call_user_method is discouraged from PHP version 5.3; use call_user_func instead');
27
        
28
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
29
        $this->assertError($file, 3, 'The use of function call_user_method is discouraged from PHP version 5.3 and forbidden from PHP version 7.0; use call_user_func instead');
30
    }
31
32
    /**
33
     * Test call user method array
34
     *
35
     * @return void
36
     */
37 View Code Duplication
    public function testCallUserMethodArray()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
    {
39
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
40
        $this->assertWarning($file, 4, 'The use of function call_user_method_array is discouraged from PHP version 5.3; use call_user_func_array instead');
41
42
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
43
        $this->assertError($file, 4, 'The use of function call_user_method_array is discouraged from PHP version 5.3 and forbidden from PHP version 7.0; use call_user_func_array instead');
44
    }
45
46
    /**
47
     * Test define syslog variables
48
     *
49
     * @return void
50
     */
51
    public function testDefineSyslogVariables()
52
    {
53
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
54
        $this->assertError($file, 5, 'The use of');
55
    }
56
57
    /**
58
     * Test dl
59
     *
60
     * @return void
61
     */
62
    public function testDl()
63
    {
64
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
65
66
        $this->assertWarning($file, 6, 'The use of function dl is discouraged from PHP version 5.3');
67
    }
68
69
    /**
70
     * Test ereg
71
     *
72
     * @return void
73
     */
74
    public function testEreg()
75
    {
76
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
77
78
        $this->assertWarning($file, 7, 'The use of function ereg is discouraged from PHP version 5.3');
79
    }
80
81
    /**
82
     * Test ereg_replace
83
     *
84
     * @return void
85
     */
86
    public function testEregReplace()
87
    {
88
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
89
90
        $this->assertWarning($file, 8, 'The use of function ereg_replace is discouraged from PHP version 5.3');
91
    }
92
93
    /**
94
     * Test eregi
95
     *
96
     * @return void
97
     */
98
    public function testEregi()
99
    {
100
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
101
102
        $this->assertWarning($file, 9, 'The use of function eregi is discouraged from PHP version 5.3');
103
    }
104
105
    /**
106
     * Test eregi_replace
107
     *
108
     * @return void
109
     */
110
    public function testEregiReplace()
111
    {
112
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
113
114
        $this->assertWarning($file, 10, 'The use of function eregi_replace is discouraged from PHP version 5.3');
115
    }
116
117
    /**
118
     * Test import_request_variables
119
     *
120
     * @return void
121
     */
122
    public function testImportRequestVariables()
123
    {
124
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
125
126
        $this->assertError($file, 11, 'The use of function import_request_variables is forbidden from PHP version 5.4');
127
    }
128
129
    /**
130
     * Test mcrypt_generic_end
131
     *
132
     * @return void
133
     */
134 View Code Duplication
    public function testMcryptGenericEnd()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
135
    {
136
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
137
        $this->assertWarning($file, 12, 'The use of function mcrypt_generic_end is discouraged from PHP version 5.4; use mcrypt_generic_deinit instead');
138
        
139
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
140
        $this->assertError($file, 12, 'The use of function mcrypt_generic_end is discouraged from PHP version 5.4 and forbidden from PHP version 7.0; use mcrypt_generic_deinit instead');
141
    }
142
143
    /**
144
     * Test mysql_db_query
145
     *
146
     * @return void
147
     */
148
    public function testMysqlDbQuery()
149
    {
150
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
151
152
        $this->assertWarning($file, 13, 'The use of function mysql_db_query is discouraged from PHP version 5.3; use mysql_select_db and mysql_query instead');
153
    }
154
155
    /**
156
     * Test mysql_escape_string
157
     *
158
     * @return void
159
     */
160
    public function testMysqlEscapeString()
161
    {
162
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
163
164
        $this->assertWarning($file, 14, 'The use of function mysql_escape_string is discouraged from PHP version 5.3; use mysql_real_escape_string instead');
165
    }
166
167
    /**
168
     * Test mysql_list_dbs
169
     *
170
     * @return void
171
     */
172
    public function testMysqlListDbs()
173
    {
174
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
175
176
        $this->assertWarning($file, 15, 'The use of function mysql_list_dbs is discouraged from PHP version 5.4');
177
    }
178
179
    /**
180
     * Test mysqli_bind_param
181
     *
182
     * @return void
183
     */
184
    public function testMysqliBindParam()
185
    {
186
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
187
188
        $this->assertError($file, 16, 'The use of function mysqli_bind_param is forbidden from PHP version 5.4; use mysqli_stmt_bind_param instead');
189
    }
190
191
    /**
192
     * Test mysqli_bind_result
193
     *
194
     * @return void
195
     */
196
    public function testMysqliBindResult()
197
    {
198
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
199
200
        $this->assertError($file, 17, 'The use of function mysqli_bind_result is forbidden from PHP version 5.4; use mysqli_stmt_bind_result instead');
201
    }
202
203
    /**
204
     * Test mysqli_client_encoding
205
     *
206
     * @return void
207
     */
208
    public function testMysqliClientEncoding()
209
    {
210
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
211
212
        $this->assertError($file, 18, 'The use of function mysqli_client_encoding is forbidden from PHP version 5.4; use mysqli_character_set_name instead');
213
    }
214
215
    /**
216
     * Test mysqli_fetch
217
     *
218
     * @return void
219
     */
220
    public function testMysqliFetch()
221
    {
222
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
223
224
        $this->assertError($file, 19, 'The use of function mysqli_fetch is forbidden from PHP version 5.4; use mysqli_stmt_fetch instead');
225
    }
226
227
    /**
228
     * Test mysqli_param_count
229
     *
230
     * @return void
231
     */
232
    public function testMysqliParamCount()
233
    {
234
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
235
236
        $this->assertError($file, 20, 'The use of function mysqli_param_count is forbidden from PHP version 5.4; use mysqli_stmt_param_count instead');
237
    }
238
239
    /**
240
     * Test mysqli_get_metadata
241
     *
242
     * @return void
243
     */
244
    public function testMysqliGetMetadata()
245
    {
246
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
247
248
        $this->assertError($file, 21, 'The use of function mysqli_get_metadata is forbidden from PHP version 5.4; use mysqli_stmt_result_metadata instead');
249
    }
250
251
    /**
252
     * Test mysqli_send_long_data
253
     *
254
     * @return void
255
     */
256
    public function testMysqliSendLongData()
257
    {
258
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
259
260
        $this->assertError($file, 22, 'The use of function mysqli_send_long_data is forbidden from PHP version 5.4; use mysqli_stmt_send_long_data instead');
261
    }
262
263
    /**
264
     * Test magic_quotes_runtime
265
     *
266
     * @return void
267
     */
268 View Code Duplication
    public function testMagicQuotesRuntime()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
269
    {
270
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
271
        $this->assertWarning($file, 23, 'The use of function magic_quotes_runtime is discouraged from PHP version 5.3');
272
        
273
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
274
        $this->assertError($file, 23, 'The use of function magic_quotes_runtime is discouraged from PHP version 5.3 and forbidden from PHP version 7.0');
275
    }
276
277
    /**
278
     * Test session_register
279
     *
280
     * @return void
281
     */
282
    public function testSessionRegister()
283
    {
284
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
285
286
        $this->assertError($file, 24, 'The use of function session_register is discouraged from PHP version 5.3 and forbidden from PHP version 5.4; use $_SESSION instead');
287
    }
288
289
    /**
290
     * Test session_unregister
291
     *
292
     * @return void
293
     */
294
    public function testSessionUnregister()
295
    {
296
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
297
298
        $this->assertError($file, 25, 'The use of function session_unregister is discouraged from PHP version 5.3 and forbidden from PHP version 5.4; use $_SESSION instead');
299
    }
300
301
    /**
302
     * Test session_is_registered
303
     *
304
     * @return void
305
     */
306
    public function testSessionIsRegistered()
307
    {
308
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
309
310
        $this->assertError($file, 26, 'The use of function session_is_registered is discouraged from PHP version 5.3 and forbidden from PHP version 5.4; use $_SESSION instead');
311
    }
312
313
    /**
314
     * Test set_magic_quotes_runtime
315
     *
316
     * @return void
317
     */
318 View Code Duplication
    public function testSetMagicQuotesRuntime()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
319
    {
320
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
321
        $this->assertWarning($file, 27, 'The use of function set_magic_quotes_runtime is discouraged from PHP version 5.3');
322
        
323
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
324
        $this->assertError($file, 27, 'The use of function set_magic_quotes_runtime is discouraged from PHP version 5.3 and forbidden from PHP version 7.0');
325
    }
326
327
    /**
328
     * Test set_socket_blocking
329
     *
330
     * @return void
331
     */
332 View Code Duplication
    public function testSetSocketBlocking()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
333
    {
334
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
335
        $this->assertWarning($file, 28, 'The use of function set_socket_blocking is discouraged from PHP version 5.3; use stream_set_blocking instead');
336
        
337
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
338
        $this->assertError($file, 28, 'The use of function set_socket_blocking is discouraged from PHP version 5.3 and forbidden from PHP version 7.0; use stream_set_blocking instead');
339
    }
340
341
    /**
342
     * Test split
343
     *
344
     * @return void
345
     */
346
    public function testSplit()
347
    {
348
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
349
350
        $this->assertWarning($file, 29, 'The use of function split is discouraged from PHP version 5.3; use preg_split instead');
351
    }
352
353
    /**
354
     * Test spliti
355
     *
356
     * @return void
357
     */
358
    public function testSpliti()
359
    {
360
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
361
362
        $this->assertWarning($file, 30, 'The use of function spliti is discouraged from PHP version 5.3; use preg_split instead');
363
    }
364
365
    /**
366
     * Test sql_regcase
367
     *
368
     * @return void
369
     */
370
    public function testSqlRegcase()
371
    {
372
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
373
374
        $this->assertWarning($file, 31, 'The use of function sql_regcase is discouraged from PHP version 5.3');
375
    }
376
377
    /**
378
     * Test php_logo_guid
379
     *
380
     * @return void
381
     */
382
    public function testPhpLogoGuid()
383
    {
384
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
385
386
        $this->assertError($file, 32, 'The use of function php_logo_guid is forbidden from PHP version 5.5');
387
    }
388
389
    /**
390
     * Test php_egg_logo_guid
391
     *
392
     * @return void
393
     */
394
    public function testPhpEggLogoGuid()
395
    {
396
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
397
398
        $this->assertError($file, 33, 'The use of function php_egg_logo_guid is forbidden from PHP version 5.5');
399
    }
400
401
    /**
402
     * Test php_real_logo_guid
403
     *
404
     * @return void
405
     */
406
    public function testPhpRealLogoGuid()
407
    {
408
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
409
410
        $this->assertError($file, 34, 'The use of function php_real_logo_guid is forbidden from PHP version 5.5');
411
    }
412
413
    /**
414
     * Test zend_logo_guid
415
     *
416
     * @return void
417
     */
418
    public function testZendLogoGuid()
419
    {
420
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
421
422
        $this->assertError($file, 35, 'The use of function zend_logo_guid is forbidden from PHP version 5.5');
423
    }
424
425
    /**
426
     * Test datefmt_set_timezone_id
427
     *
428
     * @return void
429
     */
430 View Code Duplication
    public function testDateFmtSetTimezone()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
431
    {
432
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
433
        $this->assertWarning($file, 36, 'The use of function datefmt_set_timezone_id is discouraged from PHP version 5.5; use datefmt_set_timezone instead');
434
        
435
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
436
        $this->assertError($file, 36, 'The use of function datefmt_set_timezone_id is discouraged from PHP version 5.5 and forbidden from PHP version 7.0; use datefmt_set_timezone instead');
437
    }
438
439
    /**
440
     * Test mcrypt_ecb
441
     *
442
     * @return void
443
     */
444 View Code Duplication
    public function testMcryptEcb()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
445
    {
446
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
447
        $this->assertWarning($file, 37, 'The use of function mcrypt_ecb is discouraged from PHP version 5.5');
448
        
449
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
450
        $this->assertError($file, 37, 'The use of function mcrypt_ecb is discouraged from PHP version 5.5 and forbidden from PHP version 7.0');
451
    }
452
453
    /**
454
     * Test mcrypt_cbc
455
     *
456
     * @return void
457
     */
458 View Code Duplication
    public function testMcryptCbc()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
459
    {
460
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
461
        $this->assertWarning($file, 38, 'The use of function mcrypt_cbc is discouraged from PHP version 5.5');
462
        
463
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
464
        $this->assertError($file, 38, 'The use of function mcrypt_cbc is discouraged from PHP version 5.5 and forbidden from PHP version 7.0');
465
    }
466
467
    /**
468
     * Test mcrypt_cfb
469
     *
470
     * @return void
471
     */
472 View Code Duplication
    public function testMcryptCfb()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
473
    {
474
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
475
        $this->assertWarning($file, 39, 'The use of function mcrypt_cfb is discouraged from PHP version 5.5');
476
        
477
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
478
        $this->assertError($file, 39, 'The use of function mcrypt_cfb is discouraged from PHP version 5.5 and forbidden from PHP version 7.0');
479
    }
480
481
    /**
482
     * Test mcrypt_ofb
483
     *
484
     * @return void
485
     */
486 View Code Duplication
    public function testMcryptOfb()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
487
    {
488
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
489
        $this->assertWarning($file, 40, 'The use of function mcrypt_ofb is discouraged from PHP version 5.5');
490
        
491
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
492
        $this->assertError($file, 40, 'The use of function mcrypt_ofb is discouraged from PHP version 5.5 and forbidden from PHP version 7.0');
493
    }
494
495
    /**
496
     * Test ocibindbyname
497
     *
498
     * @return void
499
     */
500
    public function testOcibindbyname()
501
    {
502
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
503
504
        $this->assertWarning($file, 41, 'The use of function ocibindbyname is discouraged from PHP version 5.4; use oci_bind_by_name instead');
505
    }
506
507
    /**
508
     * Test ocicancel
509
     *
510
     * @return void
511
     */
512
    public function testOcicancel()
513
    {
514
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
515
516
        $this->assertWarning($file, 42, 'The use of function ocicancel is discouraged from PHP version 5.4; use oci_cancel instead');
517
    }
518
519
    /**
520
     * Test ocicloselob
521
     *
522
     * @return void
523
     */
524
    public function testOcicloselob()
525
    {
526
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
527
528
        $this->assertWarning($file, 43, 'The use of function ocicloselob is discouraged from PHP version 5.4; use OCI-Lob::close instead');
529
    }
530
531
    /**
532
     * Test ocicollappend
533
     *
534
     * @return void
535
     */
536
    public function testOcicollappend()
537
    {
538
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
539
540
        $this->assertWarning($file, 44, 'The use of function ocicollappend is discouraged from PHP version 5.4; use OCI-Collection::append instead');
541
    }
542
543
    /**
544
     * Test ocicollassign
545
     *
546
     * @return void
547
     */
548
    public function testOcicollassign()
549
    {
550
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
551
552
        $this->assertWarning($file, 45, 'The use of function ocicollassign is discouraged from PHP version 5.4; use OCI-Collection::assign instead');
553
    }
554
555
    /**
556
     * Test ocicollassignelem
557
     *
558
     * @return void
559
     */
560
    public function testOcicollassignelem()
561
    {
562
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
563
564
        $this->assertWarning($file, 46, 'The use of function ocicollassignelem is discouraged from PHP version 5.4; use OCI-Collection::assignElem instead');
565
    }
566
567
    /**
568
     * Test ocicollgetelem
569
     *
570
     * @return void
571
     */
572
    public function testOcicollgetelem()
573
    {
574
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
575
576
        $this->assertWarning($file, 47, 'The use of function ocicollgetelem is discouraged from PHP version 5.4; use OCI-Collection::getElem instead');
577
    }
578
579
    /**
580
     * Test ocicollmax
581
     *
582
     * @return void
583
     */
584
    public function testOcicollmax()
585
    {
586
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
587
588
        $this->assertWarning($file, 48, 'The use of function ocicollmax is discouraged from PHP version 5.4; use OCI-Collection::max instead');
589
    }
590
591
    /**
592
     * Test ocicollsize
593
     *
594
     * @return void
595
     */
596
    public function testOcicollsize()
597
    {
598
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
599
600
        $this->assertWarning($file, 49, 'The use of function ocicollsize is discouraged from PHP version 5.4; use OCI-Collection::size instead');
601
    }
602
603
    /**
604
     * Test ocicolltrim
605
     *
606
     * @return void
607
     */
608
    public function testOcicolltrim()
609
    {
610
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
611
612
        $this->assertWarning($file, 50, 'The use of function ocicolltrim is discouraged from PHP version 5.4; use OCI-Collection::trim instead');
613
    }
614
615
    /**
616
     * Test ocicolumnisnull
617
     *
618
     * @return void
619
     */
620
    public function testOcicolumnisnull()
621
    {
622
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
623
624
        $this->assertWarning($file, 51, 'The use of function ocicolumnisnull is discouraged from PHP version 5.4; use oci_field_is_null instead');
625
    }
626
627
    /**
628
     * Test ocicolumnname
629
     *
630
     * @return void
631
     */
632
    public function testOcicolumnname()
633
    {
634
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
635
636
        $this->assertWarning($file, 52, 'The use of function ocicolumnname is discouraged from PHP version 5.4; use oci_field_name instead');
637
    }
638
639
    /**
640
     * Test ocicolumnprecision
641
     *
642
     * @return void
643
     */
644
    public function testOcicolumnprecision()
645
    {
646
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
647
648
        $this->assertWarning($file, 53, 'The use of function ocicolumnprecision is discouraged from PHP version 5.4; use oci_field_precision instead');
649
    }
650
651
    /**
652
     * Test ocicolumnscale
653
     *
654
     * @return void
655
     */
656
    public function testOcicolumnscale()
657
    {
658
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
659
660
        $this->assertWarning($file, 54, 'The use of function ocicolumnscale is discouraged from PHP version 5.4; use oci_field_scale instead');
661
    }
662
663
    /**
664
     * Test ocicolumnsize
665
     *
666
     * @return void
667
     */
668
    public function testOcicolumnsize()
669
    {
670
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
671
672
        $this->assertWarning($file, 55, 'The use of function ocicolumnsize is discouraged from PHP version 5.4; use oci_field_size instead');
673
    }
674
675
    /**
676
     * Test ocicolumntype
677
     *
678
     * @return void
679
     */
680
    public function testOcicolumntype()
681
    {
682
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
683
684
        $this->assertWarning($file, 56, 'The use of function ocicolumntype is discouraged from PHP version 5.4; use oci_field_type instead');
685
    }
686
687
    /**
688
     * Test ocicolumntyperaw
689
     *
690
     * @return void
691
     */
692
    public function testOcicolumntyperaw()
693
    {
694
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
695
696
        $this->assertWarning($file, 57, 'The use of function ocicolumntyperaw is discouraged from PHP version 5.4; use oci_field_type_raw instead');
697
    }
698
699
    /**
700
     * Test ocicommit
701
     *
702
     * @return void
703
     */
704
    public function testOcicommit()
705
    {
706
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
707
708
        $this->assertWarning($file, 58, 'The use of function ocicommit is discouraged from PHP version 5.4; use oci_commit instead');
709
    }
710
711
    /**
712
     * Test ocidefinebyname
713
     *
714
     * @return void
715
     */
716
    public function testOcidefinebyname()
717
    {
718
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
719
720
        $this->assertWarning($file, 59, 'The use of function ocidefinebyname is discouraged from PHP version 5.4; use oci_define_by_name instead');
721
    }
722
723
    /**
724
     * Test ocierror
725
     *
726
     * @return void
727
     */
728
    public function testOcierror()
729
    {
730
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
731
732
        $this->assertWarning($file, 60, 'The use of function ocierror is discouraged from PHP version 5.4; use oci_error instead');
733
    }
734
735
    /**
736
     * Test ociexecute
737
     *
738
     * @return void
739
     */
740
    public function testOciexecute()
741
    {
742
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
743
744
        $this->assertWarning($file, 61, 'The use of function ociexecute is discouraged from PHP version 5.4; use oci_execute instead');
745
    }
746
747
    /**
748
     * Test ocifetch
749
     *
750
     * @return void
751
     */
752
    public function testOcifetch()
753
    {
754
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
755
756
        $this->assertWarning($file, 62, 'The use of function ocifetch is discouraged from PHP version 5.4; use oci_fetch instead');
757
    }
758
759
    /**
760
     * Test ocifetchinto
761
     *
762
     * @return void
763
     */
764
    public function testOcifetchinto()
765
    {
766
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
767
768
        $this->assertWarning($file, 63, 'The use of function ocifetchinto is discouraged from PHP version 5.4');
769
    }
770
771
    /**
772
     * Test ocifetchstatement
773
     *
774
     * @return void
775
     */
776
    public function testOcifetchstatement()
777
    {
778
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
779
780
        $this->assertWarning($file, 64, 'The use of function ocifetchstatement is discouraged from PHP version 5.4; use oci_fetch_all instead');
781
    }
782
783
    /**
784
     * Test ocifreecollection
785
     *
786
     * @return void
787
     */
788
    public function testOcifreecollection()
789
    {
790
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
791
792
        $this->assertWarning($file, 65, 'The use of function ocifreecollection is discouraged from PHP version 5.4; use OCI-Collection::free instead');
793
    }
794
795
    /**
796
     * Test ocifreecursor
797
     *
798
     * @return void
799
     */
800
    public function testOcifreecursor()
801
    {
802
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
803
804
        $this->assertWarning($file, 66, 'The use of function ocifreecursor is discouraged from PHP version 5.4; use oci_free_statement instead');
805
    }
806
807
    /**
808
     * Test ocifreedesc
809
     *
810
     * @return void
811
     */
812
    public function testOcifreedesc()
813
    {
814
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
815
816
        $this->assertWarning($file, 67, 'The use of function ocifreedesc is discouraged from PHP version 5.4; use OCI-Lob::free instead');
817
    }
818
819
    /**
820
     * Test ocifreestatement
821
     *
822
     * @return void
823
     */
824
    public function testOcifreestatement()
825
    {
826
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
827
828
        $this->assertWarning($file, 68, 'The use of function ocifreestatement is discouraged from PHP version 5.4; use oci_free_statement instead');
829
    }
830
831
    /**
832
     * Test ociinternaldebug
833
     *
834
     * @return void
835
     */
836
    public function testOciinternaldebug()
837
    {
838
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
839
840
        $this->assertWarning($file, 69, 'The use of function ociinternaldebug is discouraged from PHP version 5.4; use oci_internal_debug instead');
841
    }
842
843
    /**
844
     * Test ociloadlob
845
     *
846
     * @return void
847
     */
848
    public function testOciloadlob()
849
    {
850
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
851
852
        $this->assertWarning($file, 70, 'The use of function ociloadlob is discouraged from PHP version 5.4; use OCI-Lob::load instead');
853
    }
854
855
    /**
856
     * Test ocilogoff
857
     *
858
     * @return void
859
     */
860
    public function testOcilogoff()
861
    {
862
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
863
864
        $this->assertWarning($file, 71, 'The use of function ocilogoff is discouraged from PHP version 5.4; use oci_close instead');
865
    }
866
867
    /**
868
     * Test ocilogon
869
     *
870
     * @return void
871
     */
872
    public function testOcilogon()
873
    {
874
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
875
876
        $this->assertWarning($file, 72, 'The use of function ocilogon is discouraged from PHP version 5.4; use oci_connect instead');
877
    }
878
879
    /**
880
     * Test ocinewcollection
881
     *
882
     * @return void
883
     */
884
    public function testOcinewcollection()
885
    {
886
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
887
888
        $this->assertWarning($file, 73, 'The use of function ocinewcollection is discouraged from PHP version 5.4; use oci_new_collection instead');
889
    }
890
891
    /**
892
     * Test ocinewcursor
893
     *
894
     * @return void
895
     */
896
    public function testOcinewcursor()
897
    {
898
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
899
900
        $this->assertWarning($file, 74, 'The use of function ocinewcursor is discouraged from PHP version 5.4; use oci_new_cursor instead');
901
    }
902
903
    /**
904
     * Test ocinewdescriptor
905
     *
906
     * @return void
907
     */
908
    public function testOcinewdescriptor()
909
    {
910
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
911
912
        $this->assertWarning($file, 75, 'The use of function ocinewdescriptor is discouraged from PHP version 5.4; use oci_new_descriptor instead');
913
    }
914
915
    /**
916
     * Test ocinlogon
917
     *
918
     * @return void
919
     */
920
    public function testOcinlogon()
921
    {
922
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
923
924
        $this->assertWarning($file, 76, 'The use of function ocinlogon is discouraged from PHP version 5.4; use oci_new_connect instead');
925
    }
926
927
    /**
928
     * Test ocinumcols
929
     *
930
     * @return void
931
     */
932
    public function testOcinumcols()
933
    {
934
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
935
936
        $this->assertWarning($file, 77, 'The use of function ocinumcols is discouraged from PHP version 5.4; use oci_num_fields instead');
937
    }
938
939
    /**
940
     * Test ociparse
941
     *
942
     * @return void
943
     */
944
    public function testOciparse()
945
    {
946
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
947
948
        $this->assertWarning($file, 78, 'The use of function ociparse is discouraged from PHP version 5.4; use oci_parse instead');
949
    }
950
951
    /**
952
     * Test ociplogon
953
     *
954
     * @return void
955
     */
956
    public function testOciplogon()
957
    {
958
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
959
960
        $this->assertWarning($file, 79, 'The use of function ociplogon is discouraged from PHP version 5.4; use oci_pconnect instead');
961
    }
962
963
    /**
964
     * Test ociresult
965
     *
966
     * @return void
967
     */
968
    public function testOciresult()
969
    {
970
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
971
972
        $this->assertWarning($file, 80, 'The use of function ociresult is discouraged from PHP version 5.4; use oci_result instead');
973
    }
974
975
    /**
976
     * Test ocirollback
977
     *
978
     * @return void
979
     */
980
    public function testOcirollback()
981
    {
982
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
983
984
        $this->assertWarning($file, 81, 'The use of function ocirollback is discouraged from PHP version 5.4; use oci_rollback instead');
985
    }
986
987
    /**
988
     * Test ocirowcount
989
     *
990
     * @return void
991
     */
992
    public function testOcirowcount()
993
    {
994
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
995
996
        $this->assertWarning($file, 82, 'The use of function ocirowcount is discouraged from PHP version 5.4; use oci_num_rows instead');
997
    }
998
999
    /**
1000
     * Test ocisavelob
1001
     *
1002
     * @return void
1003
     */
1004
    public function testOcisavelob()
1005
    {
1006
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
1007
1008
        $this->assertWarning($file, 83, 'The use of function ocisavelob is discouraged from PHP version 5.4; use OCI-Lob::save instead');
1009
    }
1010
1011
    /**
1012
     * Test ocisavelobfile
1013
     *
1014
     * @return void
1015
     */
1016
    public function testOcisavelobfile()
1017
    {
1018
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
1019
1020
        $this->assertWarning($file, 84, 'The use of function ocisavelobfile is discouraged from PHP version 5.4; use OCI-Lob::import instead');
1021
    }
1022
1023
    /**
1024
     * Test ociserverversion
1025
     *
1026
     * @return void
1027
     */
1028
    public function testOciserverversion()
1029
    {
1030
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
1031
1032
        $this->assertWarning($file, 85, 'The use of function ociserverversion is discouraged from PHP version 5.4; use oci_server_version instead');
1033
    }
1034
1035
    /**
1036
     * Test ocisetprefetch
1037
     *
1038
     * @return void
1039
     */
1040
    public function testOcisetprefetch()
1041
    {
1042
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
1043
1044
        $this->assertWarning($file, 86, 'The use of function ocisetprefetch is discouraged from PHP version 5.4; use oci_set_prefetch instead');
1045
    }
1046
1047
    /**
1048
     * Test ocistatementtype
1049
     *
1050
     * @return void
1051
     */
1052
    public function testOcistatementtype()
1053
    {
1054
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
1055
1056
        $this->assertWarning($file, 87, 'The use of function ocistatementtype is discouraged from PHP version 5.4; use oci_statement_type instead');
1057
    }
1058
1059
    /**
1060
     * Test ociwritelobtofile
1061
     *
1062
     * @return void
1063
     */
1064
    public function testOciwritelobtofile()
1065
    {
1066
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
1067
1068
        $this->assertWarning($file, 88, 'The use of function ociwritelobtofile is discouraged from PHP version 5.4; use OCI-Lob::export instead');
1069
    }
1070
1071
    /**
1072
     * Test ociwritetemporarylob
1073
     *
1074
     * @return void
1075
     */
1076
    public function testOciwritetemporarylob()
1077
    {
1078
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
1079
1080
        $this->assertWarning($file, 89, 'The use of function ociwritetemporarylob is discouraged from PHP version 5.4; use OCI-Lob::writeTemporary instead');
1081
    }
1082
1083
    /**
1084
     * Test ldap_sort
1085
     *
1086
     * @return void
1087
     */
1088
    public function testLdapSort()
1089
    {
1090
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php');
1091
    
1092
        $this->assertWarning($file, 97, 'The use of function ldap_sort is forbidden from PHP version 7.0');
1093
    }
1094
    
1095
    /**
1096
     * GD Type 1 PostScript functions
1097
     *
1098
     * @return void
1099
     */
1100
    public function testGDType1()
1101
    {
1102
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.6');
1103
        $this->assertNoViolation($file, 90);
1104
        $this->assertNoViolation($file, 91);
1105
        $this->assertNoViolation($file, 92);
1106
        $this->assertNoViolation($file, 93);
1107
        $this->assertNoViolation($file, 94);
1108
        $this->assertNoViolation($file, 95);
1109
        $this->assertNoViolation($file, 96);
1110
        
1111
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '7.0');
1112
        $this->assertError($file, 90, 'The use of function imagepsbbox is forbidden from PHP version 7.0');
1113
        $this->assertError($file, 91, 'The use of function imagepsencodefont is forbidden from PHP version 7.0');
1114
        $this->assertError($file, 92, 'The use of function imagepsextendfont is forbidden from PHP version 7.0');
1115
        $this->assertError($file, 93, 'The use of function imagepsfreefont is forbidden from PHP version 7.0');
1116
        $this->assertError($file, 94, 'The use of function imagepsloadfont is forbidden from PHP version 7.0');
1117
        $this->assertError($file, 95, 'The use of function imagepsslantfont is forbidden from PHP version 7.0');
1118
        $this->assertError($file, 96, 'The use of function imagepstext is forbidden from PHP version 7.0');
1119
    }
1120
1121
    /**
1122
     * Test when setting the testVersion
1123
     *
1124
     * @return void
1125
     */
1126
    public function testSettingTestVersion()
1127
    {
1128
        $file = $this->sniffFile('sniff-examples/deprecated_functions.php', '5.3');
1129
1130
        $this->assertNoViolation($file, 19);
1131
    }
1132
}
1133
1134