Before running any of the tests, please install the project dependencies. Choose which version of TYPO3 you would like to test against.
composer install-via-docker -- -t 12.4
composer install-via-docker -- -t 13.4# Run all tests
composer test
# Run specific kind of tests
composer test:unit
composer test:unit:local # Run using locally installed PHP
composer test:func
# Run tests in watch mode
composer test:unit:watch
composer test:func:watchUnit tests may be run either via a locally installed Composer / PHP setup, or within a Docker container.
# Run locally
vendor/bin/phpunit -c Build/Test/UnitTests.xml
# Run in Docker
Build/Test/runTests.sh
Build/Test/runTests.sh -w # Watch modeFunctional tests may only be run in Docker as they require more infrastructure to be set up.
Build/Test/runTests.sh -s functional
Build/Test/runTests.sh -s functional -w # Watch modeTo learn about available options (e.g., to select the PHP version), check the usage info:
Build/Test/runTests.sh -hYou may also interact with the Docker containers directly:
cd Build/Test/
vim .env # Edit configuration
docker compose run unit
docker compose run functional
docker compose down- Datasets may be created, for example, by exporting records from MySQL Workbench.
- When writing datasets, please use
uids that are easy to search (grep) for, and that ideally prevent merge conflicts. Some test cases use random nine-digit numbers (rand(100000000, 999999999)).
Build/Test/: Test-related setup files (e.g. configuration for PHPUnit and testing container)Tests/: Test cases. In unit tests, namespacing follows the structure ofClasses/.Tests/Fixtures: Datasets to use in functional tests.
Build the documentation using the docs:build script with Composer. This
script generates the documentation using the rendering tool for Typo3 and
places it in the Documentation-GENERATED-temp folder.
composer docs:buildTake a look at the documentation by opening the file Index.html in the folder
Documentation-GENERATED-temp in your browser.
Starts the HTTP server and mounts the mandatory directory Documentation-GENERATED-temp.
composer docs:startTake a look at the documentation by opening http://localhost:8000 in your browser.
The server runs in detached mode, so you will need to stop it manually.
composer docs:stopGenerate the database reference table by running the following command from the composer-based TYPO3 install directory (not the Kitodo.Presentation source directory):
vendor/bin/typo3 kitodo:dbdocsThe documentation container runs as a non-root user. If there are some problem regarding
the permission of container user you can link the UID and GID of host into the container
using the --user parameter.
Example:
docker run --rm --user=$(id -u):$(id -g) [...]In the docs:build Composer script, this parameter is already included.
If any issues arise, you can adjust or remove it as needed.
The default documentation directory name is Documentation-GENERATED-temp.
If you want to change the directory name add the --output parameter at the
end of the building command.
Example:
[...] --config ./Documentation --output="My_Documentation_Directory"Run PHPStan:
composer phpstanPHP CS Fixer:
# Check code style
composer php-cs-fixer:check
# Fix code style
composer php-cs-fixer:fix