Installation
On this page
#Requirements
- PHP 8.2+
- PHP Gd extension
- PrestaShop 1.7, 8 or 9
- It's all ! ✨
#PrestaShop version
PrestaShop versions 1.7, 8 and 9 are supported by the library.
#Install the library
1composer require prestaflow/php-library
#Composer scripts
Into your composer.json, add theses scripts :
1"scripts": {2 "prestaflow:default": "./vendor/prestaflow/php-library/bin/prestaflow run",3 "prestaflow:json": "@prestaflow:default --output=JSON"4},
While using JSON output, you can save the results into a file (prestaflow/results.json).
1"scripts": {2 "prestaflow:default": "./vendor/prestaflow/php-library/bin/prestaflow run",3 "prestaflow:json": "@prestaflow:default --output=JSON",4 "prestaflow:json:file": "@prestaflow:json --file"5},
#Run
1composer prestaflow:default2composer prestaflow:default -- --output="compact"
As now, if you doesn't have a <Tests> folder, you will have an error ouput.
If you have a <Tests> folder but without PrestaFlow's suites, it will show a success message.
You can also specify a different folder if needed.
1composer prestaflow:default ./FolderName
#JSON output
Also, you can get the JSON output if wanted.
1composer prestaflow:json2composer prestaflow:default -- -o "json"3composer prestaflow:default -- --output="json"
1composer prestaflow:json:file
#Working with drafts
Tests can be written at each key stage of a project.
To allow you to implement these without making the output cumbersome, you can define a test as a draft.
This gives you the option to test only drafts or, conversely, ignore them during execution.
1public $draft = true | false;
1composer prestaflow:default -- --draft2composer prestaflow:default -- --no-draft
#Working with groups
Within a set of tests, it is sometimes possible to group some of them to refer to the test typology.
You can define one or more groups (using an array).
By default, a test that does not belong to any group will be included in the "All" group.
1public $groups = 'tutorial';2public $groups = ['scenarios', 'en'];
1composer prestaflow:default -- --group=tutorial --group=other-group