Skip to content
Snippets Groups Projects
Commit 90869eec authored by danielspeicher's avatar danielspeicher
Browse files

Merge branch 'develop' into 'main'

Develop

See merge request !17
parents d5289fbc b2714435
No related branches found
No related tags found
1 merge request!17Develop
Pipeline #1252367 passed
......@@ -34,6 +34,7 @@ This will print out a list with all available tools:
- [PHP Metrics](../../../dev_tools/test.md#php-metrics)
- [Stylelint](../../../dev_tools/test.md#stylelint)
- [Eslint](../../../dev_tools/test.md#es-lint)
- [Cspell](../../../dev_tools/test.md#cspell)
## Working with Themes
......
......@@ -13,6 +13,7 @@ code analysis to unit testing.
You also have to set up your environment with the tool [l3d](../docker/l3d/index.md). The composer plugin
[Drupal Development Environment](../composer/plugin/drupal-dev-environment/index.md) does all the setup for you.
This can be executed out of the box using [Ahoy](../../plugin/ahoy/index.md) by using the shortcut `a`.
## Drupal Dependency Analysis
......@@ -97,7 +98,14 @@ You can just execute:
a test phpcs-fix <contrib_module>
```
Now th errors are gone, which saves a lot of time and effort.
Now the errors are gone, which saves a lot of time and effort.
#### Using PHPCS in a GitLab pipeline
The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal).
To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project.
Here you find more information of using [PHPCS in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/phpcs/).
### PHPStan
......@@ -133,6 +141,14 @@ a test phpstan <file_ordirectory>
Whether it is a directory, it runs the analysis for everything under this directory
recursively.
#### Using PHPStan in a GitLab pipeline
The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal).
To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project.
Here you find more information of using [PHPStan in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/phpstan/).
### PHP Lint
You can execute [PHP Lint](https://github.com/overtrue/phplint) for a specific Drupal contrib module:
......@@ -227,6 +243,16 @@ If you want to analyse a custom module, just do the following:
a test stylelintmodule ../custom/<custom_module>
```
#### Using Stylelint in a GitLab pipeline
The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal).
To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project.
Here you find more information of using [Stylelint in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/stylelint/).
### ES Lint
This is another useful tool to test your `css` files.
......@@ -241,6 +267,27 @@ If you want to analyse a custom module, just do the following:
a test eslintmodule ../custom/<custom_module>
```
#### Using ES Lint in a GitLab pipeline
The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal).
To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project.
Here you find more information of using [ES Lint in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/eslint/).
### CSpell
#### Using CSpell in a GitLab pipeline
The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal).
To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project.
Here you find more information of using [CSpell in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/cspell/).
## Unit/Kernel/Functional Testing
To execute the tests, you can use a single command:
......@@ -288,6 +335,16 @@ arrow:
You can also use the execution with the debugger.
### Using PHPUnit in a GitLab pipeline
The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal).
To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project.
Here you find more information of using [PHPUnit in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/phpunit/).
### Code Coverage
First, activate the coverage option:
......@@ -321,3 +378,52 @@ Now you can execute every test including code coverage. To check, if it is
working properly, a new view for coverage should open in your IDE, like:
![Screenshot](/files/screenshots/settings_php_test_coverage_view.png)
## End-to-end testing
Most of the time a lot Drupal modules must work together, and you want to test the entire behaviour.
Therefore, we use [Cypress](https://www.cypress.io/), which is a very powerful tool to test website functionality.
### Cypress
You will find the official documentation [here](https://docs.cypress.io/guides/overview/why-cypress).
We recommend using [Docker for Drupal](omposer/plugin/d4d/) to install cypress, so you will benefit form the great
and easy Drupal integration. You also get the corresponding [Ahoy](composer/plugin/ahoy/) commands out of the box.
Make sure the Docker container inside [l3D](docker/l3d/) for Drupal are running, and you can start Cypress by
```cypress
a cypress on
```
The container starts, and you will see the Cypress UI in a few seconds:
![Screenshot](/files/screenshots/cypress_start_screen.png)
The tests must be located in `<drupal_root>/tests/cypress/e2e` and will be automatically loaded.
As a useful convenience we provide a `commands.js` file, which is available all the time. You find it
[here](https://gitlab.lakedrops.com/docker/cypress/-/blob/main/commands.js?ref_type=heads), and it provides a lot of helpful
functions like:
- login
- createAndLogin
- drush
- and many more....
If you use Basic Auth on your website, no problem. You can pass the following two environment variables
to the Docker container:
- CYPRESS_basicauth_user={{ your.user }}
- CYPRESS_basicauth_pass={{ your.pass }}
Now the `visit` and all `login` functions take care for it automatically.
#### Using Cypress in a GitLab pipeline
The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal).
In your `.gitlab-ci.yml` you can enable a job for cypress by setting:
```cypress
DISABLE_CI_TEST_CYPRESSE2E: 0
```
......@@ -9,35 +9,6 @@ tags:
---
# Cypress
This Docker project contains the testing tool [Cypress](https://cypress.io/).
You will find the official documentation [here](https://docs.cypress.io/guides/overview/why-cypress).
We recommend using [Docker for Drupal](omposer/plugin/d4d/) to install cypress, so you will benefit form the great
and easy Drupal integration. You also get the corresponding [Ahoy](composer/plugin/ahoy/) commands out of the box.
Make sure the Docker container inside [l3D](docker/l3d/) for Drupal are running, and you can start Cypress by
This Docker project contains the testing tool [Cypress](https://cypress.io/).
For more information see [here](../../dev_tools/test.md#cypress).
```cypress
a cypress on
```
The container starts, and you will see the Cypress UI in a few seconds:
![Screenshot](/files/screenshots/cypress_start_screen.png)
The tests must be located in `<drupal_root>/tests/cypress/e2e` and will be automatically loaded.
As a useful convenience we provide a `commands.js` file, which is available all the time. You find it
[here](https://gitlab.lakedrops.com/docker/cypress/-/blob/main/commands.js?ref_type=heads), and it provides a lot of helpful
functions like:
- login
- createAndLogin
- drush
- and many more....
If you use Basic Auth on your website, no problem. You can pass the following two environment variables
to the Docker container:
- CYPRESS_basicauth_user={{ your.user }}
- CYPRESS_basicauth_pass={{ your.pass }}
Now the `visit` and all `login` functions take care for it automatically.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment