From 06aaa974b5e58a401a1ff4626ca797bf3dca5a9f Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Mon, 24 Apr 2023 16:32:57 +0200 Subject: [PATCH 1/2] EvalMathTest: fix class name The test class was copied from InventoryTest and phpunit is now complaining that it cannot find the class in the test. 1) Class EvalMathTest cannot be found in phpunit/EvalMathTest.php (phpunit 10.0.7) --- test/phpunit/EvalMathTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/phpunit/EvalMathTest.php b/test/phpunit/EvalMathTest.php index 885b80233c7..bc50c65f6b8 100644 --- a/test/phpunit/EvalMathTest.php +++ b/test/phpunit/EvalMathTest.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Quatadah Nasdami + * Copyright (C) 2023 Alexandre Janniaux * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class InventoryTest extends PHPUnit\Framework\TestCase +class EvalMathTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; From 52710d0d5e10700bf727d06006d74a1ea09a34c1 Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Fri, 14 Apr 2023 09:45:44 +0200 Subject: [PATCH 2/2] phpunit: ODFTest: fix errors on ODFTest PHP Fatal error: Declaration of ODFTest::setUpBeforeClass() must be compatible with PHPUnit\Framework\TestCase::setUpBeforeClass(): void in dolibarr/test/phpunit/ODFTest.php on line 82 --- test/phpunit/ODFTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/phpunit/ODFTest.php b/test/phpunit/ODFTest.php index fdf31140b11..4211a637303 100644 --- a/test/phpunit/ODFTest.php +++ b/test/phpunit/ODFTest.php @@ -1,6 +1,7 @@ * Copyright (C) 2023 - Thomas Negre - contact@open-dsi.fr + * Copyright (C) 2023 Alexandre Janniaux * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,7 +80,7 @@ class ODFTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { global $conf,$user,$langs,$db; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. @@ -92,7 +93,7 @@ class ODFTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { global $conf,$user,$langs,$db; $db->rollback(); @@ -105,7 +106,7 @@ class ODFTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function setUp() + protected function setUp(): void { global $conf,$user,$langs,$db; $conf=$this->savconf; @@ -121,7 +122,7 @@ class ODFTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() + protected function tearDown(): void { print __METHOD__."\n"; }