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

RedundantNullPropertyValueReviewTest::testCheck()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

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 4
nc 1
nop 2
1
<?php
2
3
  namespace Funivan\Cs\Tools\Php\RedundantNullPropertyValue\Tests;
4
5
  use Funivan\Cs\Tools\Php\RedundantNullPropertyValue\RedundantNullPropertyValueReview;
6
7
8
  /**
9
   *
10
   */
11
  class RedundantNullPropertyValueReviewTest extends \Tests\Funivan\Cs\ReviewTestCase {
12
13
    /**
14
     * @return array
15
     */
16
    public function getCheckDataProvider() {
17
      return [
18
        [
19
          '<?php
20
          class A {protected $a=1;}
21
          class B {protected static $bd=4;}
22
          ',
23
          [],
24
        ],
25
        [
26
          '<?php
27
          class A {protected $a=null;}
28
          class B {protected static $bd=null;}
29
          ',
30
          [2, 3],
31
        ],
32
        [
33
          '<?php
34
          class A {public $a = null;}
35
          class B {public static $bd = null;}
36
          ',
37
          [2, 3],
38
        ],
39
        [
40
          '<?php
41
          class A {public $a = [];}',
42
          [],
43
        ],
44
      ];
45
    }
46
47
48
    /**
49
     * @dataProvider getCheckDataProvider
50
     * @param string $input
51
     * @param array $expectErrorLines
52
     * @throws \Exception
53
     */
54
    public function testCheck($input, array $expectErrorLines) {
55
      $tool = new RedundantNullPropertyValueReview();
56
      $report = $this->process($tool, $input);
57
      $this->assertInvalidLinesInReport($report, $expectErrorLines);
58
    }
59
60
  }
61