CacheableDependencyInterface & friends

To make dealing with cacheability metadata (cache tags, cache contexts and max-age) easier, Drupal 8 has CacheableDependencyInterface.

Cache max-age

Cache max-age = time dependencies

Cache max-age is analogous to HTTP's Cache-Control header's max-age directive


Cache max-age provides a declarative way to create time-dependent caches.

Using DrupalCI on

For any project on, DrupalCI testing can be enabled from the Automated Testing link on the Project page. Please note: Only project maintainers have the ability to configure project testing.

At the top of the Automated Testing tab you will see the configuration for the existing PIFT/PIFR testing, but below that you will see the test matrix for the new DrupalCI tests:

For each supported testing environment you can enable:

Writing Automated Update Tests for Drupal 8

If your module is making a data model change related to configuration, then you need to properly update your data model (as described on child pages linked to from that page).

You'll also need to test your update, to verify that it is working correctly. You can test it manually (as described on the parent page linked above), but it is also a good idea (and required in Core development) to write an automated upgrade test for your change. This page describes how to do that.

Updating Entities and Fields in Drupal 8

If your module is making a data model change related to entities and fields, and the automatic update process doesn't handle them, then you will need to write a hook_update_N() function that will update the sites for existing users of your module who already had it installed before you made the change, so that they can continue to function. This is described below.

General notes

Some notes on hook_update_N() functions:


Subscribe with RSS Subscribe to RSS - Advanced