| @@ 12-32 (lines=21) @@ | ||
| 9 | use ZenifyCodingStandard\Sniffs\ControlStructures\NewClassSniff; |
|
| 10 | ||
| 11 | ||
| 12 | final class NewClassSniffTest extends TestCase |
|
| 13 | { |
|
| 14 | ||
| 15 | public function testDetection() |
|
| 16 | { |
|
| 17 | $codeSnifferRunner = new CodeSnifferRunner(NewClassSniff::NAME); |
|
| 18 | ||
| 19 | $this->assertSame(1, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong.php')); |
|
| 20 | $this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct.php')); |
|
| 21 | } |
|
| 22 | ||
| 23 | ||
| 24 | public function testFixing() |
|
| 25 | { |
|
| 26 | $codeSnifferRunner = new CodeSnifferRunner(NewClassSniff::NAME); |
|
| 27 | ||
| 28 | $fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong.php'); |
|
| 29 | $this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent); |
|
| 30 | } |
|
| 31 | ||
| 32 | } |
|
| 33 | ||
| @@ 12-32 (lines=21) @@ | ||
| 9 | use ZenifyCodingStandard\Sniffs\WhiteSpace\IfElseTryCatchFinallySniff; |
|
| 10 | ||
| 11 | ||
| 12 | final class IfElseTryCatchFinallySniffTest extends TestCase |
|
| 13 | { |
|
| 14 | ||
| 15 | public function testDetection() |
|
| 16 | { |
|
| 17 | $codeSnifferRunner = new CodeSnifferRunner(IfElseTryCatchFinallySniff::NAME); |
|
| 18 | ||
| 19 | $this->assertSame(3, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/wrong.php')); |
|
| 20 | $this->assertSame(0, $codeSnifferRunner->getErrorCountInFile(__DIR__ . '/correct.php')); |
|
| 21 | } |
|
| 22 | ||
| 23 | ||
| 24 | public function testFixing() |
|
| 25 | { |
|
| 26 | $codeSnifferRunner = new CodeSnifferRunner(IfElseTryCatchFinallySniff::NAME); |
|
| 27 | ||
| 28 | $fixedContent = $codeSnifferRunner->getFixedContent(__DIR__ . '/wrong.php'); |
|
| 29 | $this->assertSame(file_get_contents(__DIR__ . '/wrong-fixed.php'), $fixedContent); |
|
| 30 | } |
|
| 31 | ||
| 32 | } |
|
| 33 | ||