Completed
Push — master ( 8b81c8...699ba6 )
by Shcherbak
10:19
created

testReplaceRedundantNullValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
  namespace Funivan\Cs\Tools\Php\RedundantNullPropertyValue\Tests;
4
5
  use Funivan\Cs\Tools\Php\RedundantNullPropertyValue\RedundantNullPropertyValueFixer;
6
  use Tests\Funivan\Cs\FixerTestCase;
7
8
9
  /**
10
   *
11
   */
12
  class RedundantNullPropertyValueFixerTest extends FixerTestCase {
13
14
    /**
15
     * @return array
16
     */
17
    public function getReplaceRedundantNullValuesDataProvider() {
18
      return [
19
        [
20
          '<?php class A {protected static $b =null;}',
21
          '<?php class A {protected static $b;}',
22
        ],
23
        [
24
          '<?php class A {public   static $d= null ;}',
25
          '<?php class A {public   static $d;}',
26
        ],
27
        [
28
          '<?php class A {public $a=null;}',
29
          '<?php class A {public $a;}',
30
        ],
31
        [
32
          '<?php class A {protected $b =null;}',
33
          '<?php class A {protected $b;}',
34
        ],
35
        [
36
          '<?php class A {private $b =null;}',
37
          '<?php class A {private $b;}',
38
        ],
39
        [
40
          '<?php echo 1;',
41
          '<?php echo 1;',
42
        ],
43
        [
44
          '<?php class A {}',
45
          '<?php class A {}',
46
        ],
47
        [
48
          '<?php class A {public $a=1;}',
49
          '<?php class A {public $a=1;}',
50
        ],
51
        [
52
          '<?php class A {public $a=null;}',
53
          '<?php class A {public $a;}',
54
        ],
55
        [
56
          '<?php class A {
57
          public $a=null ;
58
          }
59
          ',
60
          '<?php class A {
61
          public $a;
62
          }
63
          ',
64
        ],
65
66
      ];
67
    }
68
69
70
    /**
71
     * @dataProvider getReplaceRedundantNullValuesDataProvider
72
     * @param string $input
73
     * @param string $expect
74
     */
75
    public function testReplaceRedundantNullValues($input, $expect) {
76
      $output = $this->convert(new RedundantNullPropertyValueFixer(), $input);
77
      $this->assertEquals($expect, $output);
78
79
    }
80
  }
81