Fix the following errors when running recent phpunit:
Message: Too few arguments to function PHPUnit\Framework\TestCase::__construct(), 0 passed in
dolibarr/test/phpunit/DateLibTzFranceTest.php on line 63 and exactly
1 expected Location: phar:///usr/share/webapps/bin/phpunit.phar/phpunit/Framework/TestCase.php:265
Indeed, the old constructor had an optional $name='' parameter but the
new constructor reads like this:
public function __construct(string $name)
and the parameter is now mandatory.
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
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)
Commit cfff62c2fa removed $conf->syslog
usage, but this file was left of as-is.
Fix a warning on the test:
Files Lib
✔ Dol basename
✔ Dol count nb of line
✔ Dol is file dir
✔ Dol other
✔ Dol mime type
✔ Dol delete dir
✔ Dol copy move delete
✘ Dol compress un compress
┐
├ Error: Attempt to assign property "enabled" on null
│
│ /home/alexandre/workspace/dolibarr/test/phpunit/FilesLibTest.php:421
┴
✔ Dol check secure access document
✔ Dol dir move
The global variables are stored in $this, and in particular $db is used
through this mean. But $this->savdb is supposed to be the immutable
global state that is stored at the test class instantiation and restored
at the beginning of each test.
For $this->savdb, I don't think any consequences are created by this,
since the object is saved by each test anyway and the $db object is
mostly a query object within a transaction, but future change could use
this to inject a different stateful $db object to trace some behaviour
in the test for instance, so make sure the correct one is used.