Issue #2579887 by StryKaizer, hussainweb, dawehner: EntityListBuilder requires cache tags

8.0.x
webchick 2015-10-04 23:51:28 -07:00
parent 1cdbe865bc
commit 9bd9390755
2 changed files with 9 additions and 0 deletions

View File

@ -228,6 +228,7 @@ class EntityListBuilder extends EntityHandlerBase implements EntityListBuilderIn
'#empty' => $this->t('There is no @label yet.', array('@label' => $this->entityType->getLabel())),
'#cache' => [
'contexts' => $this->entityType->getListCacheContexts(),
'tags' => $this->entityType->getListCacheTags(),
],
);
foreach ($this->load() as $entity) {

View File

@ -70,4 +70,12 @@ class EntityListBuilderTest extends WebTestBase {
$this->assertEqual(['entity_test_view_grants', 'languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'url.query_args.pagers:0', 'user.permissions'], $build['#cache']['contexts']);
}
/**
* Tests if the list cache tags are set.
*/
public function testCacheTags() {
$this->drupalGet('entity_test/list');
$this->assertCacheTag('entity_test_list');
}
}