getReplaceSpacesDataProvider()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 32
c 0
b 0
f 0
rs 8.8571
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
  namespace Funivan\Cs\Tools\LineEnding\Tests;
4
5
  use Funivan\Cs\Tools\LineEnding\LineEndingFixer;
6
7
  /**
8
   * @author Ivan Shcherbak <[email protected]> 2016
9
   */
10
  class LineEndingFixerTest extends \Tests\Funivan\Cs\BaseTestCase {
11
12
    /**
13
     * @return array
14
     */
15
    public function getReplaceSpacesDataProvider() {
16
      return [
17
        [
18
          '<?php\n 
19
  echo 1;\r',
20
          '<?php\n 
21
  echo 1;\n',
22
        ],
23
        [
24
          '<?php echo 1;',
25
          '<?php echo 1;',
26
        ],
27
        [
28
          '<?php\r\n
29
          echo 1;\n
30
          \r',
31
          '<?php\n
32
          echo 1;\n
33
          \n',
34
35
        ],
36
        [
37
          '<?php\n
38
\n
39
\n',
40
          '<?php\n
41
\n
42
\n',
43
44
        ],
45
      ];
46
    }
47
48
49
    /**
50
     * @dataProvider getReplaceSpacesDataProvider
51
     * @param string $input
52
     * @param string $expect
53
     */
54
    public function testReplaceInvalidLines($input, $expect) {
55
      $map = [
56
        '\r' => "\r",
57
        '\n' => "\n",
58
      ];
59
60
61
      $input = str_replace("\n", '', $input);
62
      $expect = str_replace("\n", '', $expect);
63
      $input = strtr($input, $map);
64
      $expect = strtr($expect, $map);
65
66
      \Tests\Funivan\Cs\BaseTestCase::assertFixer(new LineEndingFixer(), $input, $expect);
67
    }
68
69
  }
70