Completed
Push — php70 ( 992172...1282e6 )
by Wim
04:08
created

Sniffs/PHP/ConstantArraysUsingDefineSniffTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Constant arrays using define in PHP 7.0 sniff test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Constant arrays using define in PHP 7.0 sniff test file
11
 *
12
 * @uses BaseSniffTest
13
 * @package PHPCompatibility
14
 * @author Wim Godden <[email protected]>
15
 */
16 View Code Duplication
class ConstantArraysUsingDefineSniffTest  extends BaseSniffTest
0 ignored issues
show
This class 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...
17
{
18
    /**
19
     * Verify that checking for a specific version works
20
     *
21
     * @return void
22
     */
23
    public function testConstantArraysUsingDefine()
24
    {
25
        $file = $this->sniffFile('sniff-examples/constant_arrays_using_define.php', '7.0');
26
        $this->assertNoViolation($file, 3);
27
        $this->assertNoViolation($file, 9);
28
        $this->assertNoViolation($file, 15);
29
        
30
        $file = $this->sniffFile('sniff-examples/constant_arrays_using_define.php', '5.6');
31
        $this->assertError($file, 3, "Constant arrays using define are not allowed in PHP 5.6 or earlier");
32
        $this->assertError($file, 9, "Constant arrays using define are not allowed in PHP 5.6 or earlier");
33
        $this->assertNoViolation($file, 15);
34
    }
35
}
36