function EntityDisplayTest::testEntityDisplayInvalidateCacheTags

Same name in other branches
  1. 8.9.x core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php \Drupal\Tests\field_ui\Kernel\EntityDisplayTest::testEntityDisplayInvalidateCacheTags()
  2. 10 core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php \Drupal\Tests\field_ui\Kernel\EntityDisplayTest::testEntityDisplayInvalidateCacheTags()
  3. 11.x core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php \Drupal\Tests\field_ui\Kernel\EntityDisplayTest::testEntityDisplayInvalidateCacheTags()

Ensure that entity view display changes invalidates cache tags.

File

core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php, line 468

Class

EntityDisplayTest
Tests the entity display configuration entities.

Namespace

Drupal\Tests\field_ui\Kernel

Code

public function testEntityDisplayInvalidateCacheTags() {
    $cache = \Drupal::cache();
    $cache->set('cid', 'kittens', Cache::PERMANENT, [
        'config:entity_view_display_list',
    ]);
    $display = EntityViewDisplay::create([
        'targetEntityType' => 'entity_test',
        'bundle' => 'entity_test',
        'mode' => 'default',
    ]);
    $display->setComponent('kitten');
    $display->save();
    $this->assertFalse($cache->get('cid'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.