From a018f1ebe040d10af3fb71efb949149e10d117fc Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 18 Feb 2024 12:53:21 +0100 Subject: [PATCH] Make phpunit fail if a --filter does not execute any tests (#2924) --- phpunit.xml | 2 ++ .../PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/phpunit.xml b/phpunit.xml index 03fcbf718f..b083450096 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -4,8 +4,10 @@ bootstrap="tests/bootstrap.php" cacheResult="false" colors="true" + executionOrder="random" failOnRisky="true" failOnWarning="true" + failOnEmptyTestSuite="true" beStrictAboutChangesToGlobalState="true" beStrictAboutCoversAnnotation="true" beStrictAboutOutputDuringTests="true" diff --git a/tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php index 5232f164ff..5863760fef 100644 --- a/tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php +++ b/tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php @@ -24,6 +24,7 @@ protected function setUp(): void protected function tearDown(): void { putenv('COLUMNS'); + putenv('TERM_PROGRAM'); } public function dataFormatterOutputProvider(): iterable @@ -195,6 +196,7 @@ public function testFormatErrors( } $formatter = $this->createErrorFormatter(null); + // NOTE: extra env vars need to be cleared in tearDown() foreach ($extraEnvVars as $envVar) { putenv($envVar); }