Let's create some basic test coverage for the module that verifies that caches are invalidated correctly:

  • Let's do the test as kernel test, docs can be found here: https://www.drupal.org/docs/8/testing/types-of-tests-in-drupal-8#s-kerne...
  • Let's add a test case which installs some content type having a "tags" field (autocompletion), like articles from standard profile.
  • Then add a test module "cache_tools_article_listing" which adds some simple test route "cache-tools/articles", which renders links to all published articles and adds the cache tag "{entity}_{bundle}_pub" (but not the default cache tag like "node_list").
  • Then in the test, install the module and page cache module, then add three published articles. After accessing the route two times as logged out users, make sure the cache is populated and active. Then add another article without publishing it, and make sure the cache *stays* active. Then finally, publish that article and test that the published article shows up in the list.

Comments

fago created an issue. See original summary.

fago’s picture

Issue summary: View changes