riconet / extension-skeleton
This project contains a skeleton for TYPO3-Extbase extensions.
Requires
- php: ^7.0
README
Need to know
- This project assumes you are using gitlab, to host your extension.
- The vendor is currently defined static (This is going to change soon, dont worry.)
- There is no support for windows, currently.
Description
This composer project was created, to ease the process of creating a new extension, for the CMS TYPO3. This setup contains the commonly used files and folders, to create an extension. It also provides a configuration, to run unit and functional tests and ships a fully working gitlab-ci.yml.
How to create a new extension / How to use this project
Open your shell and navigate to the destination of your upcoming extension. Execute the following command and remember to define a name for your extension.
composer create-project riconet/extension-skeleton my_new_extension
How to run the tests
After you wrote some test files, run composer install in the root of the extension.
This will create a new folder, called .Build
.
This folder contains a TYPO3 instance (with your extension linked), a shell script for test execution and a docker-compose.yml.
You can also run code quality checks, to check your source code.
To run tests, execute the script Build/Scripts/runTests.sh
.
How to use the runTests.sh script
To execute the script, run ./Build/Scripts/runTests.sh
, in the root of your extension.
No arguments: Run all unit tests with PHP 7.2
Options
-s
Specifies which test suite to run
- composerInstall: "composer install", handy if host has no PHP, uses composer cache of users home
- composerValidate: "composer validate"
- functional: functional tests
- lint: PHP linting
- unit (default): PHP unit tests
- code-quality: executes code quality checks (phpstan, phpcs, phpmd).
-p <7.2|7.3>
Specifies the PHP minor version to be used
- 7.2 (default): use PHP 7.2
- 7.3: use PHP 7.3
-e "<phpunit options>"
Only with -s functional|unit
Additional options to send to phpunit (unit & functional tests).
Starting with "--" must be added after options starting with "-".
Example -e "-v --filter canRetrieveValueWithGP" to enable verbose output AND filter tests
named "canRetrieveValueWithGP"
-x
Only with -s functional|unit
Send information to host instance for test or system under test break points. This is especially
useful if a local PhpStorm instance is listening on default xdebug port 9000. A different port
can be selected with -y
-y <port>
Send xdebug information to a different port than default 9000 if an IDE like PhpStorm
is not listening on default port.
-u
Update existing typo3gmbh/phpXY:latest docker images. Maintenance call to docker pull latest
versions of the main php images. The images are updated once in a while and only the youngest
ones are supported by core testing. Use this if weird test errors occur. Also removes obsolete
image versions of typo3gmbh/phpXY.
-v
Enable verbose script output. Shows variables and docker commands.
-h
Show this help.
Examples:
Run unit tests using PHP 7.2:
/Build/Scripts/runTests.sh
Run unit tests using PHP 7.3
./Build/Scripts/runTests.sh -p 7.3