@@ 12-40 (lines=29) @@ | ||
9 | use ZenifyCodingStandard\Sniffs\Classes\ClassDeclarationSniff; |
|
10 | ||
11 | ||
12 | final class ClassDeclarationSniffTest extends TestCase |
|
13 | { |
|
14 | ||
15 | public function testDetection() |
|
16 | { |
|
17 | $codeSnifferRunner = new CodeSnifferRunner(ClassDeclarationSniff::NAME); |
|
18 | ||
19 | $this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong.php')); |
|
20 | $this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong2.php')); |
|
21 | $this->assertSame(2, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong3.php')); |
|
22 | $this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct.php')); |
|
23 | } |
|
24 | ||
25 | ||
26 | public function testFixing() |
|
27 | { |
|
28 | $codeSnifferRunner = new CodeSnifferRunner(ClassDeclarationSniff::NAME); |
|
29 | ||
30 | $fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong.php'); |
|
31 | $this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent); |
|
32 | ||
33 | $fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong2.php'); |
|
34 | $this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent); |
|
35 | ||
36 | $fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong3.php'); |
|
37 | $this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent); |
|
38 | } |
|
39 | ||
40 | } |
|
41 |
@@ 12-38 (lines=27) @@ | ||
9 | use ZenifyCodingStandard\Sniffs\WhiteSpace\PropertiesMethodsMutualSpacingSniff; |
|
10 | ||
11 | ||
12 | final class PropertiesMethodsMutualSpacingSniffTest extends TestCase |
|
13 | { |
|
14 | ||
15 | public function testDetection() |
|
16 | { |
|
17 | $codeSnifferRunner = new CodeSnifferRunner(PropertiesMethodsMutualSpacingSniff::NAME); |
|
18 | ||
19 | $this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong.php')); |
|
20 | $this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong2.php')); |
|
21 | $this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct.php')); |
|
22 | $this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct2.php')); |
|
23 | $this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct3.php')); |
|
24 | } |
|
25 | ||
26 | ||
27 | public function testFixing() |
|
28 | { |
|
29 | $codeSnifferRunner = new CodeSnifferRunner(PropertiesMethodsMutualSpacingSniff::NAME); |
|
30 | ||
31 | $fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong.php'); |
|
32 | $this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent); |
|
33 | ||
34 | $fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong2.php'); |
|
35 | $this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent); |
|
36 | } |
|
37 | ||
38 | } |
|
39 |