LineAfterOpenTagFixerTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

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