From 9246976958fb22e3464f7a25ef2ab97caed5aa44 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Sat, 3 Aug 2024 13:51:27 +0200 Subject: [PATCH] E2E test about path validation in ignoreErrors and excludePaths --- .github/workflows/e2e-tests.yml | 12 ++++++++++++ e2e/bad-exclude-paths/excludePaths.neon | 9 +++++++++ e2e/bad-exclude-paths/ignore.neon | 11 +++++++++++ e2e/bad-exclude-paths/src/test.php | 0 4 files changed, 32 insertions(+) create mode 100644 e2e/bad-exclude-paths/excludePaths.neon create mode 100644 e2e/bad-exclude-paths/ignore.neon create mode 100644 e2e/bad-exclude-paths/src/test.php diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 99af24c9d9..20f5e4d0a1 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -214,6 +214,18 @@ jobs: ../bashunit -a line_count 2 "$OUTPUT" ../bashunit -a contains 'Method TraitsCachingIssue\TestClassUsingTrait::doBar() should return stdClass but returns Exception.' "$OUTPUT" ../bashunit -a contains 'Method class@anonymous/TestClassUsingTrait.php:20::doBar() should return stdClass but returns Exception.' "$OUTPUT" + - script: | + cd e2e/bad-exclude-paths + OUTPUT=$(../../bin/phpstan analyse -c ignore.neon) + echo "$OUTPUT" + ../bashunit -a contains 'Invalid entry in ignoreErrors' "$OUTPUT" + ../bashunit -a contains 'tests is neither a directory, nor a file path, nor a fnmatch pattern.' "$OUTPUT" + - script: | + cd e2e/bad-exclude-paths + OUTPUT=$(../../bin/phpstan analyse -c excludePaths.neon) + echo "$OUTPUT" + ../bashunit -a contains 'Invalid entry in excludePaths' "$OUTPUT" + ../bashunit -a contains 'tests is neither a directory, nor a file path, nor a fnmatch pattern.' "$OUTPUT" steps: - name: "Checkout" diff --git a/e2e/bad-exclude-paths/excludePaths.neon b/e2e/bad-exclude-paths/excludePaths.neon new file mode 100644 index 0000000000..14ed59cad4 --- /dev/null +++ b/e2e/bad-exclude-paths/excludePaths.neon @@ -0,0 +1,9 @@ +includes: + - ../../conf/bleedingEdge.neon + +parameters: + level: 8 + paths: + - src + excludePaths: + - tests diff --git a/e2e/bad-exclude-paths/ignore.neon b/e2e/bad-exclude-paths/ignore.neon new file mode 100644 index 0000000000..26d56b4b57 --- /dev/null +++ b/e2e/bad-exclude-paths/ignore.neon @@ -0,0 +1,11 @@ +includes: + - ../../conf/bleedingEdge.neon + +parameters: + level: 8 + paths: + - src + ignoreErrors: + - + message: '#aaa#' + path: tests diff --git a/e2e/bad-exclude-paths/src/test.php b/e2e/bad-exclude-paths/src/test.php new file mode 100644 index 0000000000..e69de29bb2