LineAfterOpenTagReviewTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 70
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLineAfterOpenTagDataProvider() 0 47 1
A testLineAfterOpenTag() 0 8 2
1
<?php
2
3
  namespace Funivan\Cs\Tools\Php\LineAfterOpenTag\Tests;
4
5
  use Funivan\Cs\Tools\Php\LineAfterOpenTag\LineAfterOpenTagReview;
6
  use Tests\Funivan\Cs\BaseTestCase;
7
8
  /**
9
   *
10
   */
11
  class LineAfterOpenTagReviewTest extends BaseTestCase {
12
13
    /**
14
     * @return array
15
     */
16
    public function getLineAfterOpenTagDataProvider() {
17
      return [
18
        [
19
          '<?php
20
21
22
23
',
24
          [1],
25
        ],
26
        [
27
          '<?php
28
29
echo 1;
30
',
31
          [],
32
        ],
33
        [
34
          '<?php
35
36
echo 1;?>
37
<?
38
39
40
',
41
          [4],
42
          'process' => (boolean) ini_get('short_open_tag'),
43
        ],
44
        [
45
          '<?
46
47
echo 1;
48
',
49
          [],
50
          'process' => (boolean) ini_get('short_open_tag'),
51
        ],
52
        [
53
          '<?
54
55
56
echo 1;
57
',
58
          [1],
59
          'process' => (boolean) ini_get('short_open_tag'),
60
        ],
61
      ];
62
    }
63
64
65
    /**
66
     * @dataProvider getLineAfterOpenTagDataProvider
67
     * @param string $input
68
     * @param array $errorLines
69
     * @param bool $process
70
     */
71
    public function testLineAfterOpenTag($input, array $errorLines, $process = true) {
72
      if ($process === false) {
73
        static::markTestSkipped('PHP short open tags are not enabled.');
74
        return;
75
      }
76
      $tool = new LineAfterOpenTagReview();
77
      static::assertReview($tool, $input, $errorLines);
78
    }
79
80
  }
81