Code Duplication    Length = 8-8 lines in 11 locations

Tests/Sniffs/PHP/DeprecatedFunctionsSniffTest.php 11 locations

@@ 23-30 (lines=8) @@
20
     *
21
     * @return void
22
     */
23
    public function testCallUserMethod()
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
@@ 37-44 (lines=8) @@
34
     *
35
     * @return void
36
     */
37
    public function testCallUserMethodArray()
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
@@ 134-141 (lines=8) @@
131
     *
132
     * @return void
133
     */
134
    public function testMcryptGenericEnd()
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
@@ 268-275 (lines=8) @@
265
     *
266
     * @return void
267
     */
268
    public function testMagicQuotesRuntime()
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
@@ 318-325 (lines=8) @@
315
     *
316
     * @return void
317
     */
318
    public function testSetMagicQuotesRuntime()
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
@@ 332-339 (lines=8) @@
329
     *
330
     * @return void
331
     */
332
    public function testSetSocketBlocking()
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
@@ 430-437 (lines=8) @@
427
     *
428
     * @return void
429
     */
430
    public function testDateFmtSetTimezone()
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
@@ 444-451 (lines=8) @@
441
     *
442
     * @return void
443
     */
444
    public function testMcryptEcb()
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
@@ 458-465 (lines=8) @@
455
     *
456
     * @return void
457
     */
458
    public function testMcryptCbc()
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
@@ 472-479 (lines=8) @@
469
     *
470
     * @return void
471
     */
472
    public function testMcryptCfb()
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
@@ 486-493 (lines=8) @@
483
     *
484
     * @return void
485
     */
486
    public function testMcryptOfb()
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