Thumbnail

Test a Drupal patch with Lando

Thumbnail

Si Hobbs

|

A demonstration of applying a Drupal patch for learning purposes. Leverages Lando for local development.

This video demonstrates one way to test a Drupal patch locally on OSX, starting from nothing other than Lando and a few dev tools. It's primarily for learning purposes and isn't necessarily the best way to do it, but I think many Drupal core developers have their own methods and there is not one correct way to do this. (Thanks to Lee Rowlands and Adam Bramley for some tips.)

Local tools:

  • Lando (and Docker etc)
  • Git
  • Composer/php

Basic overview

There are some extra tidbits in the video but these are the main steps. 

  1. Clone this repo with a few handy config files
  2. Inside the repo, run composer install to get a drush
  3. Git clone Drupal 9  into ./drupal-91x
  4. Inside drupal-91x, run composer install and add a sites/default/settings.php for Lando
  5. Bring up the Lando application with lando start
  6. Inside the container run ../vendor/bin/drush si minimal to get a Drupal installation
  7. Visit https://coredev.lndo.site and login
  8. Apply a patch with curl https://drupal.org/path/to/patch.patch | git apply -v

Drush as a separate application

It was interesting working out how to get Drush available. If you add it to the Drupal core composer file, yes it works, but you get a lot of composer file changes that you have to ignore. In the end I created a simple application in the top layer so I could execute Drush against the Drupal site.

{
    "require": {
        "drush/drush": "~10",
        "drupal/core": "^9"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

 

The video 

 

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Comments

  • Allowed HTML tags: <em> <strong> <cite> <blockquote cite> <ul type> <ol start type> <li> <dl> <dt> <dd> <p>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
  • Use [gist:#####] where ##### is your gist number to embed the gist
    You may also include a specific file within a multi-file gist with [gist:####:my_file].

Spread the word