From 2e03a1cafffc4d0c656471f8da4ebc251bb6824e Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Mon, 18 Mar 2024 11:45:07 +0100 Subject: [PATCH] Configure PHPunit to convert deprecation errors to exceptions, but ignore them in tests by default. --- phpunit.xml | 6 +++++- tests/PHPUnit_Smarty.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index e0ad81d6..15e1d563 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -15,7 +15,11 @@ timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60" - verbose="false"> + verbose="false" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + convertDeprecationsToExceptions="true"> ./tests/UnitTests/ diff --git a/tests/PHPUnit_Smarty.php b/tests/PHPUnit_Smarty.php index de4a3776..bed59818 100644 --- a/tests/PHPUnit_Smarty.php +++ b/tests/PHPUnit_Smarty.php @@ -149,7 +149,7 @@ class PHPUnit_Smarty extends PHPUnit\Framework\TestCase $this->smarty->setCacheDir(__DIR__ . '/cache'); } - $this->getSmartyObj(); + $this->smarty->setErrorReporting(E_ALL &~ E_USER_DEPRECATED); } /**