Completed
Push — master ( 2eb3b3...c3dff2 )
by Shcherbak
02:38
created

LineAfterOpenTagFixerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 3
c 5
b 1
f 0
lcom 0
cbo 1
dl 0
loc 83
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSetEmptyLineDataProvider() 0 60 1
A testSetEmptyLine() 0 7 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\FixerTestCase;
7
8
  /**
9
   *
10
   */
11
  class LineAfterOpenTagFixerTest extends FixerTestCase {
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
        $this->markTestSkipped('PHP short open tags are not enabled.');
88
        return;
89
      }
90
      $this->process(new LineAfterOpenTagFixer(), $input, $expect);
91
    }
92
93
  }
94