deviantintegral / drupal_tests

A docker container based for running Drupal tests in CircleCI
GNU General Public License v3.0
24 stars 9 forks source link

Use real composer-patches format #47

Open szeidler opened 6 years ago

szeidler commented 6 years ago

At first thank you all for the great effort. I enjoy using drupal_tests.

I created a custom module now, that required to patch a contrib module. For this I'm using composer-patches with the following format in its composer.json

"extra": {
    "patches": {
      "drupal/profile": {
        "PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0": "https://www.drupal.org/files/issues/2018-08-16/profile-fix_private_tempstore-2993092-2.patch"
      }
    }
  }

In some cases we define our patches also with an external patch file like

"extra": {
        "enable-patching": true,
        "patches-file": "composer.patches.json"
    }

with the format

{
    "patches": {
      "drupal/profile": {
        "Make profile label work with tokens and expose them in the UI": "https://www.drupal.org/files/issues/2018-03-11/2900573-17.patch",
        "PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0": "https://www.drupal.org/files/issues/2018-08-16/profile-fix_private_tempstore-2993092-2.patch"
      }
    }
  }

Using drupal_tests both strategies are not applied by default. The first definition in composer.json not, because inline patch definitions are not processed in drupal_tests and second not because of the file name. But even changing the file name to patches.json does not help, because it requires a slightly different json nesting format to make it working with drupal_tests.

The following patches.json would work.

{
  "drupal/profile": {
    "PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0": "https://www.drupal.org/files/issues/2018-08-16/profile-fix_private_tempstore-2993092-2.patch"
  }
}

That means I currently would need to define the same patches twice, one for automatically being applied by composer-patches and one separate for drupal_tests. Is this a bug, or have I done a mistake in my setup?

If it is a bug, I think we should work on the RoboFile, so that it fetches either inline composer.json patches or loading in the patch-file defined in patches-file to streamline the process.

Thank you in advance for your help.

deviantintegral commented 6 years ago

It's totally a bug given our readme says we're following the composer-patches format. Now that an 8.6 RC is out I will be working on that, and I will take a look at this at the same time, unless you feel like taking this on.