Completed
Push — master ( 3d2c15...d79b98 )
by Wim
02:28
created

NewClosureSniffTest::testClosure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 5
c 1
b 1
f 0
nc 1
nop 0
dl 8
loc 8
rs 9.4285
1
<?php
2
/**
3
 * New Closure Sniff test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * New Closure Sniff tests
11
 *
12
 * @uses BaseSniffTest
13
 * @package PHPCompatibility
14
 * @author Wim Godden <[email protected]>
15
 */
16 View Code Duplication
class NewClosureSniffTest 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...
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