Code Duplication    Length = 16-18 lines in 4 locations

Tests/Sniffs/PHP/ForbiddenGlobalVariableVariableSniffTest.php 1 location

@@ 16-31 (lines=16) @@
13
 * @package PHPCompatibility
14
 * @author Wim Godden <[email protected]>
15
 */
16
class ForbiddenGlobalVariableVariableSniffTest extends BaseSniffTest
17
{
18
    /**
19
     * Verify that checking for a specific version works
20
     *
21
     * @return void
22
     */
23
    public function testGlobalVariableVariable()
24
    {
25
        $file = $this->sniffFile('sniff-examples/forbidden_global_variable_variable.php', '5.6');
26
        $this->assertNoViolation($file, 3);
27
        
28
        $file = $this->sniffFile('sniff-examples/forbidden_global_variable_variable.php', '7.0');
29
        $this->assertError($file, 3, "Global with variable variables are not allowed since PHP 7.0");
30
    }
31
}
32

Tests/Sniffs/PHP/NewClosureSniffTest.php 1 location

@@ 16-31 (lines=16) @@
13
 * @package PHPCompatibility
14
 * @author Wim Godden <[email protected]>
15
 */
16
class NewClosureSniffTest extends BaseSniffTest
17
{
18
    /**
19
     * Test closures
20
     *
21
     * @return void
22
     */
23
    public function testClosure()
24
    {
25
        $file = $this->sniffFile('sniff-examples/new_closure.php', '5.2');
26
        $this->assertError($file, 3, "Closures / anonymous functions are not available in PHP 5.2 or earlier");
27
28
        $file = $this->sniffFile('sniff-examples/new_closure.php', '5.3');
29
        $this->assertNoViolation($file, 3);
30
    }
31
}
32

Tests/Sniffs/PHP/NewFunctionArrayDereferencingSniff.php 1 location

@@ 16-31 (lines=16) @@
13
 * @package PHPCompatibility
14
 * @author Wim Godden <[email protected]>
15
 */
16
class NewFunctionArrayDereferencingSniffTest extends BaseSniffTest
17
{
18
    /**
19
     * testArrayDereferencing
20
     *
21
     * @return void
22
     */
23
    public function testArrayDereferencing()
24
    {
25
        $file = $this->sniffFile('sniff-examples/new_function_array_dereferencing.php', '5.3');
26
        $this->assertError($file, 3, 'Function array dereferencing is not present in PHP version 5.3 or earlier');
27
        
28
        $file = $this->sniffFile('sniff-examples/new_function_array_dereferencing.php', '5.4');
29
        $this->assertNoViolation($file, 3);
30
    }
31
}
32

Tests/Sniffs/PHP/ForbiddenFunctionParametersWithSameNameSniffTest.php 1 location

@@ 16-33 (lines=18) @@
13
 * @package PHPCompatibility
14
 * @author Wim Godden <[email protected]>
15
 */
16
class ForbiddenFunctionParametersWithSameNameSniffTest extends BaseSniffTest
17
{
18
    /**
19
     * testSettingTestVersion
20
     *
21
     * @group forbiddenFunctionParamsSameName
22
     *
23
     * @return void
24
     */
25
    public function testSettingTestVersion()
26
    {
27
        $file = $this->sniffFile('sniff-examples/forbidden_function_parameters_with_same_name.php', '5.6');
28
        $this->assertNoViolation($file, 3);
29
        
30
        $file = $this->sniffFile('sniff-examples/forbidden_function_parameters_with_same_name.php', '7.0');
31
        $this->assertError($file, 3, 'Functions can not have multiple parameters with the same name since PHP 7.0');
32
    }
33
}
34
35