public function EntityUnitTest::testPostSave in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php \Drupal\Tests\Core\Entity\EntityUnitTest::testPostSave()
- 9 core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php \Drupal\Tests\Core\Entity\EntityUnitTest::testPostSave()
@covers ::postSave
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUnitTest.php, line 398
Class
- EntityUnitTest
- @coversDefaultClass \Drupal\Core\Entity\EntityBase @group Entity @group Access
Namespace
Drupal\Tests\Core\EntityCode
public function testPostSave() {
$this->cacheTagsInvalidator
->expects($this
->exactly(2))
->method('invalidateTags')
->withConsecutive([
[
// List cache tag.
$this->entityTypeId . '_list',
],
], [
[
// List cache tag.
$this->entityTypeId . '_list',
// Own cache tag.
$this->entityTypeId . ':' . $this->values['id'],
],
]);
// This method is internal, so check for errors on calling it only.
$storage = $this
->createMock('\\Drupal\\Core\\Entity\\EntityStorageInterface');
// A creation should trigger the invalidation of the "list" cache tag.
$this->entity
->postSave($storage, FALSE);
// An update should trigger the invalidation of both the "list" and the
// "own" cache tags.
$this->entity
->postSave($storage, TRUE);
}