From 06405a838d00399d606984c1146f9cae50924dda Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Mon, 26 Feb 2024 02:16:15 +0100 Subject: [PATCH] Add more tests (#202) --- tests/File/FileHelperTest.php | 20 ++++++++++++++++++++ tests/Ruleset/RulesetTest.php | 3 +++ 2 files changed, 23 insertions(+) diff --git a/tests/File/FileHelperTest.php b/tests/File/FileHelperTest.php index f31671af..b7653765 100644 --- a/tests/File/FileHelperTest.php +++ b/tests/File/FileHelperTest.php @@ -9,6 +9,26 @@ final class FileHelperTest extends TestCase { + /** + * @dataProvider detectEOLDataProvider + */ + public function testDetectEOL( + string $content, + string $expected, + ): void { + static::assertSame($expected, FileHelper::detectEOL($content)); + } + + /** + * @return iterable + */ + public static function detectEOLDataProvider(): iterable + { + yield ['foo', \PHP_EOL]; + yield ["foo\n", "\n"]; + yield ["foo\r\n", "\r\n"]; + } + /** * @dataProvider removeDotDataProvider */ diff --git a/tests/Ruleset/RulesetTest.php b/tests/Ruleset/RulesetTest.php index a26cb3a0..4fee3c42 100644 --- a/tests/Ruleset/RulesetTest.php +++ b/tests/Ruleset/RulesetTest.php @@ -69,5 +69,8 @@ protected function process(int $tokenPosition, array $tokens): void $ruleset->allowNonFixableRules(false); static::assertCount(1, $ruleset->getRules()); + + $ruleset->allowNonFixableRules(); + static::assertCount(2, $ruleset->getRules()); } }