Completed
Push — master ( 72728a...d29f9c )
by Wim
02:52
created

testMktimeIsdst()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
cc 1
eloc 23
c 2
b 1
f 1
nc 1
nop 0
dl 0
loc 26
rs 8.8571
1
<?php
2
/**
3
 * Removed Functions Parameter Sniff test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Removed Functions Parameter Sniff test file
11
 *
12
 * @uses BaseSniffTest
13
 * @package PHPCompatibility
14
 * @author Wim Godden <[email protected]>
15
 */
16
class RemovedFunctionParameterSniffTest extends BaseSniffTest
17
{
18
    /**
19
     * Test mktime() is_dst parameter
20
     *
21
     * @return void
22
     */
23
    public function testMktimeIsdst()
24
    {
25
        $file = $this->sniffFile('sniff-examples/removed_function_parameter.php', '5.0');
26
        $this->assertNoViolation($file, 3);
27
        $this->assertNoViolation($file, 8);
28
        $this->assertNoViolation($file, 9);
29
        $this->assertNoViolation($file, 10);
30
        $this->assertNoViolation($file, 11);
31
        $this->assertNoViolation($file, 12);
32
        $this->assertNoViolation($file, 13);
33
        $this->assertNoViolation($file, 14);
34
        $this->assertNoViolation($file, 15);
35
        $this->assertNoViolation($file, 17);
36
        
37
        $file = $this->sniffFile('sniff-examples/removed_function_parameter.php', '7.0');
38
        $this->assertError($file, 3, "The function mktime does not have a parameter is_dst in PHP version 7.0 or later");
39
        $this->assertNoViolation($file, 8);
40
        $this->assertNoViolation($file, 9);
41
        $this->assertNoViolation($file, 10);
42
        $this->assertNoViolation($file, 11);
43
        $this->assertNoViolation($file, 12);
44
        $this->assertNoViolation($file, 13);
45
        $this->assertNoViolation($file, 14);
46
        $this->assertNoViolation($file, 15);
47
        $this->assertNoViolation($file, 17);
48
    }
49
    
50
    /**
51
     * Test gmmktime() is_dst parameter
52
     *
53
     * @return void
54
     */
55
    public function testGmmktimeIsdst()
56
    {
57
        $file = $this->sniffFile('sniff-examples/removed_function_parameter.php', '5.6');
58
        $this->assertNoViolation($file, 5);
59
    
60
        $file = $this->sniffFile('sniff-examples/removed_function_parameter.php', '7.0');
61
        $this->assertError($file, 5, "The function gmmktime does not have a parameter is_dst in PHP version 7.0 or later");
62
    }
63
}
64