From 7879e12bd24dcfc8fa26091c822b67c613c65817 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Jul 2024 02:22:26 +0200 Subject: [PATCH] Fix phpunit --- test/phpunit/AllTests.php | 5 +++++ test/phpunit/JsonLibTest.php | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index c96380bdcc5..9eb4e51e7fa 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -24,6 +24,7 @@ * \brief This file is a test suite to run all unit tests * \remarks To run this script as CLI: phpunit filename.php */ + print "PHP Version: ".phpversion()."\n"; print "Memory limit: ". ini_get('memory_limit')."\n"; @@ -32,6 +33,10 @@ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $_SERVER['PHP_SELF'] = "phpunit"; } +if (! defined('NOREQUIREUSER')) { + define('PHPUNIT_MODE', 1); +} + global $conf,$user,$langs,$db; //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver //require_once 'PHPUnit/Autoload.php'; diff --git a/test/phpunit/JsonLibTest.php b/test/phpunit/JsonLibTest.php index 177093e190c..44ca302323d 100644 --- a/test/phpunit/JsonLibTest.php +++ b/test/phpunit/JsonLibTest.php @@ -24,7 +24,9 @@ * \remarks To run this script as CLI: phpunit filename.php */ -define('PHPUNIT_MODE', 1); +if (! defined('NOREQUIREUSER')) { + define('PHPUNIT_MODE', 1); +} global $conf,$user,$langs,$db; //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver