Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qual: Fix/complete/refactor ModuleTest case. #28373

Merged
merged 6 commits into from
Feb 23, 2024

Conversation

mdeweerd
Copy link
Contributor

Fix: Correct CommonClassTest's constructor

Dataproviders did not work because of the issue with the constructor

Qual: Refactor module name list, add mapping to class name

Based on ModuleTest and search for modules in the code, complete the
list of modules and map to the class names.

This will allow reuse in the ModuleTest.

Qual: Refactor ModulesInit test

Use the updated common module mapping list, more complete than
the original list.
Also refactor the test to use a data provider.

Note

Module list needs review/completion.

# Fix: Correct CommonClassTest's constructor

Dataproviders did not work because of the issue with the constructor
# Qual: Refactor module name list, add mapping to class name

Based on ModuleTest and search for modules in the code, complete the
list of modules and map to the class names.

This will allow reuse in the ModuleTest.
# Qual: Refactor ModulesInit test

Use the updated common module mapping list, more complete than
the original list.
Also refactor the test to use a data provider.
@mdeweerd mdeweerd force-pushed the modules/refactor_extend_test branch from 5d90855 to e41d058 Compare February 23, 2024 11:43
# Fix: valid module test must now use array_key_exists

Because of the introduction of null key values, isset on the array no
longer works, using array_key_exists to test if the modulename is valid.
# Qual: Less verbosity for tests

The verbosity on setup/teardown/... is not really usefull and
makes the log less readable.  Reducing the verbosity while allowing
to set an environment variable PHPUNIT_DEBUG to enable it.
'ReceiptPrinter','Reception','Recruitment','Resource',
'Salaries','Service','SocialNetworks','Societe','Stock','Stripe','SupplierProposal','Syslog',
'TakePos','Tax','Ticket','User','Variants','WebServices','WebServicesClient','Website','Workflow','Workstation','Zapier');
foreach ($modulelist as $modlabel) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand where is the foreach after the change ?

Copy link
Contributor Author

@mdeweerd mdeweerd Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the "dataProvider" feature from PHPunit.

moduleInitListProvider() provides the arguments to pass on to the test function - phpunit loops over that list of lists of arguments and executes the test as an independent test.

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Feb 23, 2024
@eldy eldy merged commit f3a3de8 into Dolibarr:develop Feb 23, 2024
6 checks passed
@mdeweerd mdeweerd deleted the modules/refactor_extend_test branch February 23, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants