Notice: You are browsing the documentation for PrestaShop 8, which is currently in development.You might want to read the documentation for the current version, PrestaShop 1.7.
PrestaShop is a complex software and uses automated testing to ensure that the new additions to the codebase do not break existing behaviors.
Automated tests are located in
tests folder, you will find:
Unit tests are powered by PHPUnit. They test one and only one php class, mocking/stubbing any dependencies that class has.
Unit folder meets some rules:
If there is a hard-coded dependency such as a singleton pattern being used or a static call, this class cannot be unit tested and should be tested using integration tests.
testGetPrice(no idea what such a test is supposed to do)
Unit tests can validate the behavior of a php class when it can be isolated. However, some classes cannot be validated this way. Moreover, a lot of logic from PrestaShop is written into complex SQL queries that cannot be validated by those kind of tests. This is why we also need integration tests.
We use 2 technologies for the integration tests in the
Finally, we have some user interface tests (also sometimes referred to as web acceptance tests). These tests launch and control a browser that will then go on either the Front Office or the Back Office of a shop and perform several actions to check that the behavior, from the point of view of a browser, is as expected. So these tests send real HTTP requests and check the returned DOM.
These tests can be found in
UI tests rely on Playwright.
tests-legacy folder only contains tests targeting these endpoints:
These endpoints have not been migrated to
tests folder due to their complexity.