Completed
Pull Request — master (#167)
by Juliette
02:58
created

testIsDeprecated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 8
loc 8
rs 9.4285
1
<?php
2
/**
3
 * PHP4 style constructors sniff test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
/**
9
 * PHP4 style constructors sniff test
10
 *
11
 * @uses BaseSniffTest
12
 * @package PHPCompatibility
13
 * @author Koen Eelen <[email protected]>
14
 */
15 View Code Duplication
class DeprecatedPHP4StyleConstructorsSniffTest extends BaseSniffTest
0 ignored issues
show
Duplication introduced by
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...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
{
17
    /**
18
     * Test PHP4 style constructors.
19
     *
20
     * @group deprecatedPHP4Constructors
21
     *
22
     * @return void
23
     */
24
    public function testIsDeprecated()
25
    {
26
        $file = $this->sniffFile('sniff-examples/deprecated_php4style_constructors.php', '5.6');
27
        $this->assertNoViolation($file, 3);
28
29
        $file = $this->sniffFile('sniff-examples/deprecated_php4style_constructors.php', '7.0');
30
        $this->assertError($file, 3, 'Deprecated PHP4 style constructor are not supported since PHP7');
31
    }
32
33
    /**
34
     * Test valid methods with the same name as the class.
35
     *
36
     * @group deprecatedPHP4Constructors
37
     *
38
     * @return void
39
     */
40
    public function testValidMethods()
41
    {
42
        $file = $this->sniffFile('sniff-examples/deprecated_php4style_constructors.php', '7.0');
43
        $this->assertNoViolation($file, 9);
44
        $this->assertNoViolation($file, 20);
45
    }
46
}
47