Commit d83ebbd8 authored by Marc Egger's avatar Marc Egger
Browse files

phpunit.md: Add phpunit setup instructions

parent ba442b1d
# phpunit
# Phpunit
## run unit tests from commandline
## Setup
After running `make bootstrap` go to the extension folder and run:
Requirements for running the php unittests:
- `make bootstrap` was executed
- The following files exist at the same location (either `extension/` or `typo3conf/`):
* `config.qfq.php`
* `LocalConfiguration.php`
- The database credentials in `config.qfq.php` are correct
- The database with the name `DB_1_NAME` followed by `_phpunit` exists. E.g. `app_qfq_phpunit` where `DB_1_NAME=app_qfq`
In Tests/Unit/ you may find a mockup of `LocalConfiguration.php`
and a template for `config.qfq.php`.
## Run unit tests from commandline
REMARK: Running the unit tests without specifying the configuration file `phpunit.xml` will not work. See section "Autoloader" for explanation.
From the extension folder run:
`vendor/bin/phpunit --configuration phpunit.xml`
## phpunit configurations
## Phpunit configurations
Phpunit configurations are stored in extension/phpunit.xml
Running the tests without specifying these configurations will not work.
......@@ -14,18 +30,11 @@ Running the tests without specifying these configurations will not work.
## Autoloader
The test classes use the composer autoloader to reference to the source classes.
The autoloader is loaded in extension/Classes/bootstrap.php which in turn is executed by phpunit before each test
as specified in phpunit.xml by the line `<phpunit bootstrap="Classes/bootstrap.php">`
The autoloader is loaded by phpunit before each test
as specified in phpunit.xml by the line `<phpunit bootstrap="vendor/autoload.php">`
## run tests on gitlab runner (i.e. without typo3 installation)
## Run tests without typo3 installation (e.g. gitlab runner)
As defined in the phpunit command of projectRoot/Makefile.
The files phpunit_config.qfq.php and phpunit_LocalConfiguration.php are copied outside the extension since
they are necessary for the qfq bootstrap process.
## Database Setup
TODO
Needs existing database: <name>_phpunit
\ No newline at end of file
The files phpunit_config.qfq.php and phpunit_LocalConfiguration.php are copied outside the extension folder by the Makefile.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment