From b9ee0e1d2cbdf599777ec05544e3d24aff9560d5 Mon Sep 17 00:00:00 2001 From: Raphael Stolt Date: Sat, 2 Nov 2024 16:50:01 +0100 Subject: [PATCH] Expands the PHP preset --- src/Presets/PhpPreset.php | 1 + tests/AnalyserTest.php | 32 ++++++++++++++++++++++++++++++ tests/Commands/InitCommandTest.php | 1 + 3 files changed, 34 insertions(+) diff --git a/src/Presets/PhpPreset.php b/src/Presets/PhpPreset.php index 15f4699..5aa493e 100644 --- a/src/Presets/PhpPreset.php +++ b/src/Presets/PhpPreset.php @@ -16,6 +16,7 @@ public function getPresetGlob(): array '*.txt', '*.rst', '*.{md,MD}', + '*.{png,gif,jpeg,jpg,webp}', '*.xml', '*.yml', 'phpunit*', diff --git a/tests/AnalyserTest.php b/tests/AnalyserTest.php index ed99b8e..7df6323 100755 --- a/tests/AnalyserTest.php +++ b/tests/AnalyserTest.php @@ -1382,6 +1382,37 @@ public function presentGitignoredSpecsCoverageDirectoryIsExcludedFromValidation( $this->assertTrue($analyser->hasCompleteExportIgnores()); } + #[Test] + public function exportIgnoresExpectedImages(): void + { + $artifactFilenames = [ + 'test.png', + 'test.gif', + 'test.jpg', + 'test.jpeg', + 'test.webp', + ]; + + $this->createTemporaryFiles( + $artifactFilenames + ); + + $gitattributesContent = <<createTemporaryGitattributesFile($gitattributesContent); + + $analyser = (new Analyser(new Finder(new PhpPreset())))->setDirectory($this->temporaryDirectory); + $this->assertTrue($analyser->hasCompleteExportIgnores()); + } + #[Test] #[Group('glob')] public function returnsExpectedDefaultGlobPatterns(): void @@ -1394,6 +1425,7 @@ public function returnsExpectedDefaultGlobPatterns(): void '*.txt', '*.rst', '*.{md,MD}', + '*.{png,gif,jpeg,jpg,webp}', '*.xml', '*.yml', 'phpunit*', diff --git a/tests/Commands/InitCommandTest.php b/tests/Commands/InitCommandTest.php index bbdcff5..901d169 100644 --- a/tests/Commands/InitCommandTest.php +++ b/tests/Commands/InitCommandTest.php @@ -73,6 +73,7 @@ public function createsExpectedDefaultLpvFile(): void *.txt *.rst *.{md,MD} +*.{png,gif,jpeg,jpg,webp} *.xml *.yml phpunit*