Completed
Push — master ( 385e70...bfc368 )
by Shcherbak
02:13
created

getReplaceSpacesDataProvider()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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