I have been working on a tidy setup for contribution using available community tools, and today I needed the same for core. Core patches and Contrib have slightly different workflows.
Anyway, it turned out really easy to do this.
Get your codebase
I already had a copy of the Drupal core codebase in
~/Projects/src/drupal, checked out to my branch (
I copied in the following two Lando
# Change to `true` and run `lando rebuild` to enable XDebug.
- apt update && apt install libxslt1-dev -y && docker-php-ext-install xsl
- composer install --prefer-dist
cmd: "php /app/vendor/bin/phpunit -c /app/core/phpunit.xml.dist"
# lando composer require --dev squizlabs/php_codesniffer
# lando phpcs --config-set installed_paths /app/vendor/drupal/coder/coder_sniffer
cmd: /app/vendor/bin/phpcs --standard=Drupal,DrupalPractice
cmd: /app/vendor/bin/phpcbf --standard=Drupal,DrupalPractice
Start your engines
PHPUnit has various ways of filtering which tests to run. In this case I had only one test I needed to run:
lando phpunit core/tests/Drupal/KernelTests/Core/Theme/ConfirmClassyCopiesTest.php
It's fast :)
$ lando phpunit core/tests/Drupal/KernelTests/Core/Theme/ConfirmClassyCopiesTest.php PHPUnit 8.5.19 by Sebastian Bergmann and contributors. Testing Drupal\KernelTests\Core\Theme\ConfirmClassyCopiesTest ..... 5 / 5 (100%) Time: 2.23 seconds, Memory: 6.00 MB OK (5 tests, 2481 assertions)
Upload your changes
Pushed my changes to the merge request per the instructions on the issue. Done!
For more information on contributing to Drupal, see Contributor Guide: Quick Info.