Code Duplication    Length = 12-14 lines in 4 locations

Tests/Sniffs/PHP/DeprecatedNewReferenceSniffTest.php 1 location

@@ 23-34 (lines=12) @@
20
     *
21
     * @return void
22
     */
23
    public function testNewReference()
24
    {
25
        $file = $this->sniffFile('sniff-examples/deprecated_new_reference.php', '5.3');
26
        $this->assertNoViolation($file, 8);
27
        $this->assertWarning($file, 9, 'Assigning the return value of new by reference is deprecated in PHP 5.3');
28
        $this->assertWarning($file, 10, 'Assigning the return value of new by reference is deprecated in PHP 5.3');
29
        
30
        $file = $this->sniffFile('sniff-examples/deprecated_new_reference.php', '7.0');
31
        $this->assertNoViolation($file, 8);
32
        $this->assertError($file, 9, 'Assigning the return value of new by reference is deprecated in PHP 5.3 and forbidden in PHP 7.0');
33
        $this->assertError($file, 10, 'Assigning the return value of new by reference is deprecated in PHP 5.3 and forbidden in PHP 7.0');
34
    }
35
36
    /**
37
     * testSettingTestVersion

Tests/Sniffs/PHP/ForbiddenParenthesisAroundFunctionParametersSniffTest.php 1 location

@@ 23-36 (lines=14) @@
20
     *
21
     * @return void
22
     */
23
    public function testSettingTestVersion()
24
    {
25
        $file = $this->sniffFile('sniff-examples/forbidden_parenthesis_around_function_parameters.php', '5.6');
26
        $this->assertNoViolation($file, 3);
27
        $this->assertNoViolation($file, 5);
28
        $this->assertNoViolation($file, 7);
29
        $this->assertNoViolation($file, 9);
30
        
31
        $file = $this->sniffFile('sniff-examples/forbidden_parenthesis_around_function_parameters.php', '7.0');
32
        $this->assertWarning($file, 3, 'Parentheses around function parameters throws warning in PHP 7.0');
33
        $this->assertWarning($file, 5, 'Parentheses around function parameters throws warning in PHP 7.0');
34
        $this->assertWarning($file, 7, 'Parentheses around function parameters throws warning in PHP 7.0');
35
        $this->assertNoViolation($file, 9);
36
    }
37
}
38
39

Tests/Sniffs/PHP/DeprecatedIniDirectivesSniffTest.php 1 location

@@ 420-433 (lines=14) @@
417
     *
418
     * @return void
419
     */
420
    public function testAlwaysPopulateRawPostData()
421
    {
422
        $file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.5');
423
        $this->assertNoViolation($file, 80);
424
        $this->assertNoViolation($file, 81);
425
426
        $file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6');
427
        $this->assertWarning($file, 80, "INI directive 'always_populate_raw_post_data' is deprecated from PHP 5.6");
428
        $this->assertWarning($file, 81, "INI directive 'always_populate_raw_post_data' is deprecated from PHP 5.6");
429
    
430
        $file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '7.0');
431
        $this->assertError($file, 80, "INI directive 'always_populate_raw_post_data' is deprecated from PHP 5.6 and forbidden from PHP 7.0");
432
        $this->assertError($file, 81, "INI directive 'always_populate_raw_post_data' is deprecated from PHP 5.6 and forbidden from PHP 7.0");
433
    }
434
435
    /**
436
     * Test asp_tags setting

Tests/Sniffs/PHP/ForbiddenSwitchWithMultipleDefaultBlocksSniffTest.php 1 location

@@ 23-34 (lines=12) @@
20
     *
21
     * @return void
22
     */
23
    public function testSettingTestVersion()
24
    {
25
        $file = $this->sniffFile('sniff-examples/forbidden_switch_with_multiple_default_blocks.php', '5.6');
26
        $this->assertNoViolation($file, 3);
27
        $this->assertNoViolation($file, 14);
28
        $this->assertNoViolation($file, 23);
29
        
30
        $file = $this->sniffFile('sniff-examples/forbidden_switch_with_multiple_default_blocks.php', '7.0');
31
        $this->assertError($file, 3, 'Switch statements can not have multiple default blocks since PHP 7.0');
32
        $this->assertNoViolation($file, 14);
33
        $this->assertNoViolation($file, 23);
34
    }
35
}
36
37