-
danielspeicher authoreddanielspeicher authored
title: Testing
tags:
- documentation
- tools
- tests
Testing Drupal Code
This section describes everything we have to test our code from static code analysis to unit testing.
You also have to set up your environment with the tool l3d. The composer plugin Drupal Development Environment does all the setup for you.
Drupal Dependency Analysis
This tools provides a very useful functionality. You can check, if there are new versions of a module. We have the following categories:
- Direct dependencies required in composer.json
- Transitive dependencies not required in composer.json
Usage:
a test outdated
Note: This can take a while depending on your installation.
Provides an output something like this:
Transitive dependencies not required in composer.json:
drupal/blazy 2.16.0 2.27.0 Provides..
Static Code Analysis
We have several tools to perform static code analysis.
PHP Code Sniffer
PHP Code Sniffer performs a static code analysis with a specific Drupal profile. It detects code smells like static calls. See PHP Code Sniffer.
You can execute PHP CS for a specific Drupal contrib module:
a test phpcsmodule <contrib_module>
Now the entire code in that module will be analysed.