Inside Drush 9

greg.1.anderson
moshe weitzman

Drush has grown and transformed quite a lot since it first became a part of the Drupal development tools ecosystem over a decade ago. As Drush evolved, it became apparent that maintenance was the largest problem that we faced. In particular, the introduction of Composer use in Drupal 8 presented a new and unique set of challenges for Drush that needed to be overcome. At the same time, Composer provided a new opportunity that allowed us to leverage code from other projects, and at the same time also gave us the means to export libraries that can now be used elsewhere. Encapsulating capabilities into APIs has made a huge improvement in the maintainability and testability of Drush.

This session will look inside Drush 9 and show how some of these libraries fit together, and how to re-use them in other programs. Some of the capabilities that will be covered include:

  • Site aliases: Address remote systems with short names.
  • Backend invoke: Run programs on remote systems using ssh.
  • Configuration: Override commandline option values and provide other configuration in yaml files.
  • Output formatters: Provide consistent transformations between tabular output, json, yaml and other formats.

We will also take a look at how Drush manages its test suites:

  • "Unish" test framework: Builds a Drupal "system under test" and includes Drush inside it to create an accurate operating environment for functional testing.
  • Test scenarios: Maintain multiple composer.lock files to improve dependency testing.
  • Integration tests: Get most of the fidelity of the functional testing environment, but with much higher performance.

This session assumes the audience has some experience with PHP and the Symfony Console component. After attending this session, you will have better insight into how to make a PHP library or commandline tool that is testable and maintainable.

Program tags

apis, beyond drupal, testing

Experience Level

Intermediate

Drupal Version