2
0
forked from Wavyzz/dolibarr
Commit Graph

41 Commits

Author SHA1 Message Date
Alexandre Janniaux
0cc1cfc1ee FIX: CommandeTest: fix create when no company exists
The testCommandeCreate() is using the default value for Commande::socid,
which is defined by Command::initAsSpecimen to `0`. But if no companies
have been created, the test will fail with the following error:

    Failed asserting that 0 is less than -1.

Or with the additional logging:

    ERROR:  23503: insert or update on table "llx_commande" violates foreign key constraint "fk_commande_fk_soc"
    DETAIL:  Key (fk_soc)=(1) is not present in table "llx_societe".                                            
    SCHEMA NAME:  public                                                                                        
    TABLE NAME:  llx_commande                                                                                   
    CONSTRAINT NAME:  fk_commande_fk_soc                                                                        
    LOCATION:  ri_ReportViolation, ri_triggers.c:2596,                                                          
    Failed asserting that 0 is less than -1.

The test doesn't really depends on specific test data so we can create
the company directly instead.
2023-12-17 15:45:25 +01:00
Laurent Destailleur
de7d3c2bf8 Fix with php-cs-fixer 2023-12-04 11:22:28 +01:00
Laurent Destailleur
5dae5b57a0 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
2023-05-17 12:27:46 +02:00
Alexandre Janniaux
df0adc391d FIX test/phpunit: add $name to __construct()
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.
2023-05-08 16:29:31 +02:00
Alexandre Janniaux
b6235c29d0 phpunit: use $db instead of $this->savdb
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.
2023-04-26 16:44:07 +02:00
Laurent Destailleur
b55271dedb Fix warning 2023-04-15 03:27:35 +02:00
Laurent Destailleur
6c17c2f044 Test travis php7.1 2022-09-21 17:55:04 +02:00
Laurent Destailleur
4da5aeedf4 Fix bad test 2021-05-12 08:42:33 +02:00
Frédéric FRANCE
db8afec96b Update CommandeTest.php 2021-02-09 23:51:49 +01:00
Frédéric FRANCE
b1a1cd4be6 code syntax 2021-01-14 15:09:08 +01:00
Frédéric FRANCE
3ea613896e Update CommandeTest.php 2020-05-20 23:04:38 +02:00
Laurent Destailleur
4d6a45d491 Major doxygen fix 2020-05-03 22:48:35 +02:00
Alexandre SPANGARO
02dbc11f98 Move Gnu.org to https 2019-09-23 21:55:30 +02:00
Laurent Destailleur
3af4ad7fc3 Compatibility with phpunit v6 2019-07-05 21:28:27 +02:00
Frédéric FRANCE
42a1387218 wip 2019-02-25 00:56:48 +01:00
Laurent Destailleur
3d3edb19d8 Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts:
	.travis.yml
	htdocs/langs/en_US/commercial.lang
2018-09-02 15:48:26 +02:00
Laurent Destailleur
a7dfc88b59 Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
Conflicts:
	test/phpunit/CoreTest.php
2018-09-02 15:21:21 +02:00
Laurent Destailleur
a69c3caf2c Prepare compatibility with phpunit 6.1 2018-09-02 14:10:06 +02:00
Frédéric FRANCE
6aee680a4f PSR2 ClassDeclaration 2018-08-29 22:06:05 +02:00
Laurent Destailleur
80bce6b62d Add phpunit for accountingaccount 2018-05-18 09:25:59 +02:00
Laurent Destailleur
ce32da6217 Fix debugs APIs 2017-12-01 15:39:18 +01:00
Laurent Destailleur
435be30047 Clean code 2015-03-17 00:35:17 +01:00
frederic34
73fda2cb86 WIP PSR2 2015-01-08 18:36:03 +01:00
Laurent Destailleur
cfc337a79a Qual: Enable php checkstyle rule Zend.Files.ClosingTag
Fix: Solve a lot of checkstyle errors.
2014-07-20 15:27:38 +02:00
Laurent Destailleur
69eaefc459 Fix: The way we tested if a ref/id already exists was wrong. Introduce a
common static method for this. Removed verifNumRef method.
Fix: Add missing logs
2014-05-13 10:12:45 +02:00
Laurent Destailleur
19fb5e5085 Try to fix phpunit error with new version. 2014-05-01 19:57:53 +02:00
Laurent Destailleur
8d206fdfb0 Prepare move to other licence. For the moment all answers for licence
upgrade were not yet received. So we prepare for GPL by uniformizing
licence text keys to GPL-3+. Will move later to AGPL if all answers are
positive.
2013-01-16 15:36:08 +01:00
Marcos García
5a73c32f46 Migrated ClassName to __construct() function
Changed $DB to $db
lower-cased "Class"
2012-07-30 17:17:33 +02:00
Regis Houssin
3bfd9182e0 Fix: uniformize code 2012-07-06 13:43:59 +02:00
Laurent Destailleur
fc62b1c9c7 Removed all checkstyle errors into phpunit files 2012-02-18 01:07:52 +01:00
Laurent Destailleur
9b3bab5ff9 Doxygen 2012-02-17 16:02:35 +01:00
Laurent Destailleur
2093b3f0be New: Allow to use ODT templates for prososal like it's done for invoices 2012-02-05 19:37:52 +01:00
Laurent Destailleur
95a292f41b Fix: Update licence files 2011-12-17 21:58:44 +01:00
Laurent Destailleur
2a456b08d5 Enhance PHPUnit tests 2011-09-23 12:21:00 +00:00
Regis Houssin
e2f9864f42 Add build files for Hudson server
Fix: avoid errors with PHPUnit/Autoload.php
2011-09-16 16:16:39 +00:00
Laurent Destailleur
d7c2b906cd Qual: Add more phpunit tests 2011-09-10 12:28:00 +00:00
Regis Houssin
726d9581dd Fix: remove obsolete tags (in progress) 2011-08-27 14:24:16 +00:00
Laurent Destailleur
43ce5a638e Increase unit test code coverage (now 21%) 2010-10-26 19:47:19 +00:00
Laurent Destailleur
6f26f35529 Add more phpunit tests 2010-10-13 19:01:22 +00:00
Laurent Destailleur
fa526a9509 Qual: Add more PHPUnit tests 2010-10-03 18:53:40 +00:00
Laurent Destailleur
6e0b42afb1 Add selenium tests 2010-08-15 23:19:46 +00:00