Completed
Push — master ( 68bd43...22e0e3 )
by Дмитрий
02:33
created

ArrayShortDefinitionTest::testShortDefintion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 7
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 17
rs 9.4285
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace Tests\PHPSA\Analyzer\Pass\Expression;
7
8
use PhpParser\Node\Expr\Array_;
9
use PHPSA\Analyzer\Pass\Expression\ArrayShortDefinition;
10
11
class ArrayShortDefinitionTest extends \Tests\PHPSA\TestCase
12
{
13
    public function testLongDefintion()
14
    {
15
        $analyzer = new ArrayShortDefinition();
16
        $result = $analyzer->pass(
17
            new Array_(
18
                [],
19
                [
20
                    /**
21
                     * $a = array();
22
                     */
23
                    'kind' => Array_::KIND_LONG
24
                ]
25
            ),
26
            $this->getContext()
27
        );
28
        self::assertTrue($result);
29
    }
30
31
    public function testShortDefintion()
32
    {
33
        $analyzer = new ArrayShortDefinition();
34
        $result = $analyzer->pass(
35
            new Array_(
36
                [],
37
                [
38
                    /**
39
                     * $a = [];
40
                     */
41
                    'kind' => Array_::KIND_SHORT
42
                ]
43
            ),
44
            $this->getContext()
45
        );
46
        self::assertFalse($result);
47
    }
48
}