Skip to content
Snippets Groups Projects
Verified Commit 16e2b64f authored by Dave Long's avatar Dave Long
Browse files

Issue #3214630 by dcam, rpayanm, larowlan, Darren Oh: Invalidate /aggregator...

Issue #3214630 by dcam, rpayanm, larowlan, Darren Oh: Invalidate /aggregator page cache when feeds update
parent 6559c7cb
No related branches found
No related tags found
5 merge requests!8394[warning] array_flip(): Can only flip STRING and INTEGER values, when saving a non-revisionable custom content entity,!7780issue 3443822: fix for 'No route found for the specified format html. Supported formats: json, xml.',!4848Issue #1566662: Update module should send notifications on Thursdays,!4792Issue #2230689: Remove redundant "Italic" style,!1459Issue #3087632: menu_name max length is too long
......@@ -176,6 +176,7 @@ public function pageLast() {
$items = $this->entityTypeManager()->getStorage('aggregator_item')->loadAll(20);
$build = $this->buildPageList($items);
$build['#attached']['feed'][] = ['aggregator/rss', $this->config('system.site')->get('name') . ' ' . $this->t('aggregator')];
$build['#cache']['tags'] = $this->entityTypeManager()->getDefinition('aggregator_item')->getListCacheTags();
return $build;
}
......
......@@ -100,9 +100,21 @@ public function testFeedPage() {
// Create a feed with 30 items.
$this->createSampleNodes(30);
// Request the /aggregator page so that it is cached.
$this->drupalGet('aggregator');
$feed = $this->createFeed();
$this->updateFeedItems($feed, 30);
// Verify that items are loaded on the page by checking for the pager.
$this->drupalGet('aggregator');
$this->assertSession()->elementExists('xpath', '//ul[contains(@class, "pager__items")]');
// Save the feed entity to invalidate the cache so that the paginated cache
// context can be tested.
$feed->save();
// Request page with no feed items to ensure cache context is set correctly.
$this->drupalGet('aggregator', ['query' => ['page' => 2]]);
// Check for presence of an aggregator pager.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment